gcc linking / libtools / building stuff

Dave Johnson dave-gnhlug-list at davej.org
Wed Jan 16 22:38:11 EST 2008


Bruce Labitt writes:
> So I tried to just build it from the command line and this is what I got.
> 
> $ gcc main_tb_fftw.cpp -otbfft -I/usr/local/include -L/usr/local/lib 
> -lfftw3 -lm
> /tmp/ccJMISfw.o: In function 
> `__static_initialization_and_destruction_0(int, int)':
> main_tb_fftw.cpp:(.text+0x23): undefined reference to 
> `std::ios_base::Init::Init()'
> /tmp/ccJMISfw.o: In function `__tcf_0':
> main_tb_fftw.cpp:(.text+0x6c): undefined reference to 
> `std::ios_base::Init::~Init()'
> /tmp/ccJMISfw.o:(.eh_frame+0x12): undefined reference to 
> `__gxx_personality_v0'
> collect2: ld returned 1 exit status
> 
> So what does all that mean???  The program did compile and link using 
> Dev-C++ (gcc) on windoze.  It looks like it can't find iostream ?  I 
> have that included in main_tb_fftw.
> 
> Thanks!

Add '-lstdc++'.

Might also be more correct to invoke 'g++' instaed of 'gcc'.  gcc will
pick up on the language by the filename extension, but if you did
compile and link on two different commands, you'd need to invoke g++
for the link stage instead of gcc.

-- 
Dave


More information about the gnhlug-discuss mailing list