Content originally posted in LPCWare by Dave Such on Tue Jan 20 14:16:25 MST 2015
Hello,
Very new to XPresso workbench. Have been using IAR for several years with LPC2292/2294. I have several projects that are successfully built using IAR. As a way of introducing myself to Xpresso, I decide to take one of my smaller ones and see what it takes to port over to this compiler.
After about a week of porting about 20 source files, I can now compile all of them without errors or warnings. However, when it goes to link it, I am getting several errors from main.o about -- undefined reference to --. These are referring to variables / functions that are defined in other header files, used in main.c. I have searched through this forum as well as the FAQ and have not found anything to help me. After trying several things and going through the options, I am at a loss.
I decided to simplify this. I created a new project using the wizard. I added one c file with its h file. Added one function in it, defined it in the h file along with a variable. I then called this function from main() along with incrementing the variable. Same results. Both files compile but I get the linker error.
Any help/suggestions would be appreciated. Here is a sample from the console
15:57:09 **** Incremental Build of configuration Debug for project Test ****
make all
Building file: ../src/hello.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -I"C:\Documents and Settings\Dave\My Documents\LPCXpresso_7.3.0_186\workspace\DPA4plus\src" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=arm7tdmi -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"src/hello.d" -MT"src/hello.o" -MT"src/hello.d" -o "src/hello.o" "../src/hello.c"
Finished building: ../src/hello.c
Building file: ../src/main.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -I"C:\Documents and Settings\Dave\My Documents\LPCXpresso_7.3.0_186\workspace\DPA4plus\src" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=arm7tdmi -D__REDLIB__ -specs=redlib.specs -MMD -MP -MF"src/main.d" -MT"src/main.o" -MT"src/main.d" -o "src/main.o" "../src/main.c"
Finished building: ../src/main.c
Building target: Test.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -Xlinker -Map="Test.map" -Xlinker --gc-sections -mcpu=arm7tdmi -T "Test_Debug.ld" -o "Test.axf" ./src/cr_startup_lpc22.o ./src/crp.o ./src/hello.o ./src/main.o
./src/main.o: In function `main':
C:\Dave2\60xxwork\Test\Debug/../src/main.c:36: undefined reference to `ulDebug1'
collect2.exe: error: ld returned 1 exit status
make: *** [Test.axf] Error 1
15:57:10 Build Finished (took 1s.547ms)
ulDebug is the variable defined in hello.h
Thanks