PDA

View Full Version : Problem in linking



bargi
January 22nd, 2008, 07:49 AM
Hi,

I have the linking problem.........

I have compile the program but it is giving me linking error as follow:

[code]
Runtime.cpp:(.text+0x19f3): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
Runtime.cpp:(.text+0x1a03): undefined reference to `std::allocator<char>::~allocator()'
Runtime.cpp:(.text+0x1a16): undefined reference to `std::allocator<char>::~allocator()'
std::char_traits<char>, std::allocator<char> > const&)':
Runtime.cpp:(.text+0x1a78): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
Runtime.cpp:(.text+0x1a8b): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
StringUtilities.cpp:(.text+0x1c): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
`__static_initialization_and_destruction_0(int, int)':
StringUtilities.cpp:(.text+0x57): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()'

[code]



One more thing is that I am using boost libraries...when I compile earlier it was giving error ,so I used -fpermissive to remove it. But now it is giving me linking error.

Can anybody help me in resolving this problem.

Thanks

LaRoza
January 22nd, 2008, 07:50 AM
How are you compiling? Give the code.

bargi
January 22nd, 2008, 09:04 AM
Thanks for Reply !

First of all I run autoreconf command which created the makefile.in.

After that I run projectconfigure command which is our custom command for creating makefile.

After that make....

I have set boost library path in LD_LIBRARY_PATH environment variable
and boost is install in /home/Project/lib/boost

When I first run the make command it give me error on some warnings...and instruction to use fpremissive, so I used it and it remove that error but give linking error....

Is there problem with gcc ?

Thanks


Thanks

LaRoza
January 22nd, 2008, 09:08 AM
Is there problem with gcc ?


Try "g++"

bargi
January 22nd, 2008, 09:19 AM
Hi !

How can I change gcc option ...?

Makefile is generated automatically.......

Thanks

LaRoza
January 22nd, 2008, 09:22 AM
Oh, I don't know much about makefiles, and am not really good at C++.

Is everything you need installed?

hod139
January 22nd, 2008, 03:08 PM
gcc foo.cpp -lstdc++

bargi
January 24th, 2008, 07:44 AM
Thanks for reply.......

But in my project I have to compile with makefile which r generated from configure.ac file.........

How can I make changes so that it compile with libstdc++ libraries..
Or should I set environment variables for it....

Please give suggestion.........

Thanks a lot

Bargi

wolfbone
January 24th, 2008, 10:52 AM
Thanks for reply.......

But in my project I have to compile with makefile which r generated from configure.ac file.........

How can I make changes so that it compile with libstdc++ libraries..
Or should I set environment variables for it....

Please give suggestion.........

Thanks a lot

Bargi

Did you put "AC_PROG_CXX" in your configure.ac or configure.in?

bargi
January 24th, 2008, 12:59 PM
I have solved the problem........

I have to include "AC_PROG_CC" in my configure.ac file.......

But I can't understand that when I am using "AC_PROG_CXX" then why should I add "AC_PROG_CC" ??

I will be thankful for your reply ..........

Thanks

wolfbone
January 24th, 2008, 02:09 PM
But I can't understand that when I am using "AC_PROG_CXX" then why should I add "AC_PROG_CC" ??
Thanks

No idea. It works fine for me. But I don't use any custom "projectconfigure" command. Perhaps that is the source of the problem?