This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
undefined reference to
- From: jmchu at uci dot edu
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 24 Aug 2010 23:55:52 -0700
- Subject: undefined reference to
Hi,
I am running Cygwin on Windows 7 and I am trying to compile a c file that
has uses a function from a c++ file. However I keep on getting undefined
reference to the c++ function
In my ATmegaBOOT_xx8.c file,
I declared the header of the c++ file
extern "C" {
#include "wireless.h"
}
C:\Users\School\dkirkby-athomeleaf-a657898>make adaboot328
cygwin warning:
MS-DOS style path detected:
C:\\Users\\School\\arduino-0015/hardware/cores/arduino/pins_arduino.c
Preferred POSIX equivalent is:
/cygdrive/c/Users/School/arduino-0015/hardware/cores/arduino/pins_arduino.c
CYGWIN environment variable option "nodosfilewarning" turns off this
warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
C:\\Users\\School\\arduino-0015/hardware/tools/avr/bin/avr-g++ -v -g -Wall
-O2 -mmcu=atmega328p -DF_CPU=16000000L '-DMAX_TIME_COUNT=F_CPU>>2'
'-DNUM_LED_FLASHES=3' '-DWATCHDOG_MODS' -Wl,--section-st
art=.text=0x7800 -o ATmegaBOOT_xx8_adaboot328.elf ATmegaBOOT_xx8.o
Using built-in specs.
Target: avr
Configured with: ../gcc-4.3.2/configure
--enable-win32-registry=WinAVR-20081205 --with-gmp=/usr/local
--with-mpfr=/usr/local --prefix=/c/WinAVR --target=avr
--enable-languages=c,c++,objc --with-dwarf2
--enable-doc --disable-shared --disable-libada --disable-libssp
--disable-nls --with-pkgversion='WinAVR 20081205'
--with-bugurl='URL:http://sourceforge.net/tracker/?atid=520074&group_id=68108&func=br
owse'
Thread model: single
gcc version 4.3.2 (WinAVR 20081205)
COMPILER_PATH=c:/users/school/arduino-0015/hardware/tools/avr/bin/../libexec/gcc/avr/4.3.2/;c:/users/school/arduino-0015/hardware/tools/avr/bin/../libexec/gcc/;c:/users/school/arduino-0015/hardware/to
ols/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/
LIBRARY_PATH=c:/users/school/arduino-0015/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr5/;c:/users/school/arduino-0015/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr5/;c:/users/
school/arduino-0015/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/;c:/users/school/arduino-0015/hardware/tools/avr/bin/../lib/gcc/;c:/users/school/arduino-0015/hardware/tools/avr/bin/../lib/gcc/avr/4.3.
2/../../../../avr/lib/
COLLECT_GCC_OPTIONS='-v' '-g' '-Wall' '-O2' '-mmcu=atmega328p'
'-DF_CPU=16000000L' '-DMAX_TIME_COUNT=F_CPU>>2' '-DNUM_LED_FLASHES=3'
'-DWATCHDOG_MODS' '-o' 'ATmegaBOOT_xx8_adaboot328.elf'
c:/users/school/arduino-0015/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe
-m avr5 -Tdata 0x800100 -o ATmegaBOOT_xx8_adaboot328.elf
c:/users/school/arduino-0015/hardware/tool
s/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr5/crtm328p.o
-Lc:/users/school/arduino-0015/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr5
-Lc:/users/school/arduino-0015/hardware/tools/avr/bin
/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr5
-Lc:/users/school/arduino-0015/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2
-Lc:/users/school/arduino-0015/hardware/tools/avr/bin/../lib/gcc
-Lc:/users/sc
hool/arduino-0015/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib
--section-start=.text=0x7800 ATmegaBOOT_xx8.o -lgcc -lm -lgcc -lc -lgcc
ATmegaBOOT_xx8.o: In function `main':
C:\Users\School\dkirkby-athomeleaf-a657898/ATmegaBOOT_xx8.c:262: undefined
reference to `initNordic'
make: *** [ATmegaBOOT_xx8_adaboot328.elf] Error 1
I think the linker does not know where to look for my wireless.o file,
it is at the current directory of make file/build.328/obj
how do I tell the linker where to look? when I tried -l/build.328/obj ,
it kept saying folder not found