Problems compiling/linking with two GCC versions installed.
Posted on 2008-10-07
I've dug myself into a hole.
I have compiled and installed GCC from source, two versions (3.1.4 and 4.3.2). I have used the -prefix=/usr/local/gcc-3.1.4 and -prefix=/usr/local/gcc-4.3.2 for both. I have added a sym link from /usr/local/bin/g++ to /usr/local/gcc-3.4.1/bin/g++.
I am compiling a C++ project using NetBeans. When it compiles, I get the following errors multiple times:
/usr/local/lib/libpqxx.a(connection_base.o): In function `operator<< <std::char_traits<char> >':
/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../include/c++/4.3.2/ostream:517: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
I have no idea why it is referencing the include files in 4.3.2. I don't know exactly how gcc or NetBeans works with all the standard c++ libraries. I'm also using libpq and libpqxx libraries to do DB stuff.
* Fedora Core 8.
* NetBeans 6.1.
* GCC 3.4.1 and 4.3.2.
* GNU Make 3.8.1.
A long time ago (a few weeks ago) before I started fidgeting with gcc, I used to just compile and build c++ code with the gcc compiler that was installed with Fedora, and it worked fine. Somewhere along the line I started using libpqxx code that wasn't compiling correctly, so I update gcc for that.
Then I was able to build and run the code with the newer compiler, but when I ran it I would get the following error:
dimages: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by dimages)
..."dimages" being the name of my program. So I read a few posts that gave me the idea to try to use an older compiler. This is where I am now stuck.
Thanks in advance!