Pages: [1]   Go Down
Author Topic: Help with Makefile 0022  (Read 1167 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 1
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello -

I am trying to get a Makefile working, as I'm happier in a text editor than the IDE. I had one working for arduino version 0021, but when I upgraded to 0022, it's not working, and hoping someone can shed light on why - the error I get is:

/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/main.cpp:7: undefined reference to `setup'
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/main.cpp:10: undefined reference to `loop'

(the full output is below).

So, a couple questions:

1. Is there a 'blessed' Makefile for version 0022? It seems that a bunch of stuff has changed between 0021 and 0022 - if anyone out there has a build file which references the latest Arduino version (0022) that would be awesome.

2. Can anyone shed any light on why the link step isn't seeing the setup and loop functions (these are defined in my Main.cpp, and look to be linked into the build).

Any help is greatly appreciated.

Thx.

The build output:

...

/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a /Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/wiring_pulse.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a /Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/wiring_analog.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a /Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/pins_arduino.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a /Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/wiring.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a /Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/wiring_digital.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a /Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WInterrupts.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a /Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/wiring_shift.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a /Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/libraries/Wire/utility/twi.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a ./lib/WiShield_user_contrib/clock-arch.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a ./lib/WiShield_user_contrib/g2100.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a ./lib/WiShield_user_contrib/network.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a ./lib/WiShield_user_contrib/psock.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a ./lib/WiShield_user_contrib/stack.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a ./lib/WiShield_user_contrib/strings.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a ./lib/WiShield_user_contrib/timer.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a ./lib/WiShield_user_contrib/uip.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a ./lib/WiShield_user_contrib/uip_arp.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a /Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/main.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a /Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WMath.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-ar rcs source/core.a ./lib/WiShield_user_contrib/WiServer.o
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-gcc -Os -lm -Wl,--gc-sections -mmcu=atmega328p -o source/Main.elf source/Main.o source/core.a
source/core.a(main.o): In function `main':
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/main.cpp:7: undefined reference to `setup'
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/main.cpp:10: undefined reference to `loop'

and the main pieces from the Makefile:


C_MODULES =  \
   $(ARDUINO)/wiring_pulse.c \
   $(ARDUINO)/wiring_analog.c \
   $(ARDUINO)/pins_arduino.c \
   $(ARDUINO)/wiring.c \
   $(ARDUINO)/wiring_digital.c \
   $(ARDUINO)/WInterrupts.c \
   $(ARDUINO)/wiring_shift.c \
   $(INSTALL_DIR)/libraries/Wire/utility/twi.c \
   $(WISHIELD_PATH)/clock-arch.c \
   $(WISHIELD_PATH)/g2100.c \
   $(WISHIELD_PATH)/network.c \
   $(WISHIELD_PATH)/psock.c \
   $(WISHIELD_PATH)/stack.c \
   $(WISHIELD_PATH)/strings.c \
   $(WISHIELD_PATH)/timer.c \
   $(WISHIELD_PATH)/uip.c \
   $(WISHIELD_PATH)/uip_arp.c \

CXX_MODULES = \
   $(ARDUINO)/main.cpp \
   $(ARDUINO)/WMath.cpp \
   $(WISHIELD_PATH)/WiServer.cpp \

CXX_APP = Main.cpp

# Place -I options here
CINCS = -I$(ARDUINO) \
   -I$(INSTALL_DIR)/libraries/Servo \
   -I$(INSTALL_DIR)/libraries/SPI \
   -I$(INSTALL_DIR)/libraries/Wire \
   -I$(INSTALL_DIR)/libraries/Wire/utility \
   -I./source \
   -I$(DEVICE_PATH) \
   -I$(METRO_PATH) \
   -I$(SOFTWARE_SERIAL_PATH) \
   -I$(WISHIELD_PATH) \

CXXINCS = -I$(ARDUINO)
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6634
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Can anyone shed any light on why the link step isn't seeing the setup and loop functions (these are defined in my Main.cpp, and look to be linked into the build).
I do not see Main.cpp being compiled anywhere in the build log.  (main.cpp is compiled, but that's part of the core library.  (BTW, I think it's a bad idea for your sketch to have the same name as one of the core library files except for capitalization...))
 
(oops.  I assume Main.cpp was already compiled; I see the link includes it:
/Programs/Arduino/0022/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-gcc -Os -lm -Wl,--gc-sections -mmcu=atmega328p -o source/Main.elf source/Main.o source/core.a
However, you're putting all the code in a library, which makes searching the library rather dependent on the order in which things are included.  I think you need to put at least "main.o" outside of the library, and perhaps first in the list of .o files.
« Last Edit: February 13, 2011, 10:47:04 pm by westfw » Logged

Germany
Offline Offline
Edison Member
*
Karma: 132
Posts: 1440
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Makefile of the DOGM128 lib works quite well with the Arduino:
http://code.google.com/p/dogm128/source/browse/libraries/Dogm/examples/SpaceTrash/Makefile.uno_dogs102

Oliver
Logged

Pages: [1]   Go Up
Jump to: