Can't Build -- Receive Error "undefined reference to std::basic_ostream"



  • Hello. I'm trying to built Qt 4.8.3 under RedHat RHEL 5.8 (libc 2.5) with g++ versions 4.4.6 and 4.1.2. I use a simple configure (with and without -fast) and gmake only to get this undefined reference when linking.

    @gmake[2]: Entering directory qt-everywhere-opensource-src-4.8.3/tools/qmlplugindump' ... g++ -Wl,-rpath-link,/u/US_SCRATCH3/cots/qt-everywhere-opensource-src-4.8.3/lib -m64 -Wl,-O1 -Wl,-rpath,/app/unsupported/qt-4.8.3/lib -Wl,-rpath,/app/unsupported/qt-4.8.3/lib -o ../../bin/qmlplugindump .obj/release-shared/main.o .obj/release-shared/qmlstreamwriter.o -L/u/US_SCRATCH3/cots/qt-everywhere-opensource-src-4.8.3/lib -lQtDeclarative -L/u/US_SCRATCH3/cots/qt-everywhere-opensource-src-4.8.3/lib -lQtScript -lQtSvg -L/usr/X11R6/lib64 -lQtSql -lQtXmlPatterns -lQtNetwork -lQtGui -lQtCore -lpthread .obj/release-shared/main.o: In functionmain':
    main.cpp:(.text+0x448a): 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*, long)'
    collect2: ld returned 1 exit status@

    Thanks,
    Chris



  • This is very strange. If I manually cd into the directory and issue the g++ myself, it will compile. I have to do this over and over with different files in different directories, but it appears to be working. Why?



  • Hello.
    I met the same "undefined reference to `std::basic_ostream<char ..."
    with qt-everywhere-opensource-src-4.8.2, at same point, qmlplugindump, and many others, as Chris.

    In my case, this was due to coexistence of g++44 and default g++ (4.1.2) on our platform
    Making C++='g++44' and CC='gcc44' was not enought, as LINK keeps "g++" from mkspecs/common/g++-base.conf.
    In short, I had to change gcc/g++ by gcc44/g++44 in g++-base.conf itself.

    Hope this helps, even late!
    Cheers,
    Claude


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.