John (Eljay) Love-Jensen wrote: > > Hi ruks, > >> I am doing migration from GCC 3.4.3 to GCC 4.1.2.While doing that >> compilation >> is success after some errors. > > I'm not quite sure what you mean by "success after some errors". > > I *presume* that you mean there were some errors compiling your source > code > with GCC 4.1.2, and that you have since resolved those errors, and now > your > source code compiles cleanly with GCC 4.1.2. > > If that is not what you meant, please clarify. > >> But while linking, it throws tons to "undefined reference to" errors. > > Hard to say given the information you have provided. Could be many > things. > > My best guess (which may be entirely mistaken) is that you have some C++ > link libraries (.a or .so) which are still compiled with GCC 3.4.3. > > Note that C code should link, regardless if compiled with GCC 3.4.3 or GCC > 4.1.2. > > But all the C++ source code should use the same compiler, even the C++ > source code in the static and dynamic libraries. (There are exceptions to > this guideline, but take it as a general rule-of-thumb if you want to > eliminate bothersome worry tracking down exactly which versions of GCC's > C++ > can be linked together.) > > I'm just guessing here, though. You did not specify whether your source > code is in C, C++, Fortran, Pascal, Ada, D, Java, Objective-C, or some > other > front-end language supported* by GCC. > > * I'm using "supported" to include both FSF provided front-end languages > to > GCC, as well as third-party front-end languages which use GCC as their > back-end. > >> I am using libtool as well but the version is 1.5.10. Whether I need to >> upgrade libtool too? > > Should not hurt to upgrade. May or may not be necessary, though. > >> How to solve this problem ("undefined reference to")? > > For a start, it is helpful to know what the linker is indicating is > undefined. > > Then it is helpful to track down what part of the code has the unresolved > reference. > > Then it is helpful to track down the part of the code which is supposed to > be providing that symbol. > > Lastly, figure out why the that symbol is not available during link time. > Could be that there is a missing foo.o on the link line which contains the > desired Foo symbol. Or that a foo.a library is in the wrong parameter > order > on the GCC link line -- order of parameters is significant. > > HTH, > --Eljay > > > Hi, I am using c++ source code. Previously we used to use GCC 3.4.3 compiler for compilation. Now there is no change in the source code. Only difference is GCC 4.1.2. During compilation, first it throws "Explicit instantiation" next it throws "too few template parameter list" error: too few template-parameter-lists Original source code: int ylmm::basic_scanner<YLMM_SCANNER_CLASS::token_type, YLMM_SCANNER_CLASS::location_type, YLMM_SCANNER_CLASS::scanner_id, YLMM_SCANNER_CLASS::lock_type>::length() const Changed code: template<typename Token, typename Location, int id, typename Lock> int ylmm::basic_scanner<Token, Location, id, Lock>::length() const { return yyleng; } cmpilation was success, but linking throws Errors /bin/sh ./libtool --mode=link g++ -L./../thirdparty/RHEL/5u1/jtc/lib -L./../thirdparty/RHEL/5u1/orbacus/lib -L./../thirdparty/RHEL/5u1/ldapsdk/lib -L./../lib -o test_client/client_test/testTest util/GenVersion/version.o cmn/config/gcs/Common/AlarmProxy.o cmn/config/gcs/Common/LdapData.o cmn/config/gcs/Common/LdapProxy.o test_client/client_test/testLib.o test_client/client_test/testProxy.o test_client/client_test/ActionsParser.o test_client/client_test/ActionsScanner.o test_client/client_test/ClassTest.o test_client/client_test/ConfigBase.o test_client/client_test/ConfigHelper.o test_client/client_test/ConfigTest.o test_client/client_test/ConvertString.o test_client/client_test/DirectorJob.o test_client/client_test/DirectorLine.o test_client/client_test/DirectorPid.o test_client/client_test/DirectorProcess.o test_client/client_test/DirectorStat.o test_client/client_test/DirectorTest.o test_client/client_test/Exception.o test_client/client_test/FiltersParser.o test_client/client_test/FiltersScanner.o test_client/client_test/FunctionTable.o test_client/client_test/GcsLib.o test_client/client_test/IntCode.o test_client/client_test/Lib++.o test_client/client_test/Main.o test_client/client_test/RegisterTest.o test_client/client_test/ScriptTest.o test_client/client_test/Servers.o test_client/client_test/SetupTest.o test_client/client_test/SymTab.o test_client/client_test/SyntTree.o test_client/client_test/VM.o test_client/client_test/actionslex.o test_client/client_test/filterslex.o test_client/client_test/actions.o test_client/client_test/filters.o ../lib/libtestWrapper.la ../lib/libtest++.la ../lib/libLdapOpe.la ../lib/libThreadLib.la ../lib/libcmnDictionary.la ../lib/libcmnTrace.la ../lib/libcmnLib.la ../lib/libCommandLine.la ../lib/libXstring.la ../lib/libRegistry.la ../lib/libSendInternalAlarm.la ../lib/libGcsIdlSkel.la ../lib/libInternalAlarmIdl.la ../lib/libNtSvcExIdlSkel.la -lOB -lJTC -lldap50 -lpthread g++ -o test_client/client_test/.libs/testTest util/GenVersion/version.o cmn/config/gcs/Common/AlarmProxy.o cmn/config/gcs/Common/LdapData.o cmn/config/gcs/Common/LdapProxy.o test_client/client_test/testLib.o test_client/client_test/testProxy.o test_client/client_test/ActionsParser.o test_client/client_test/ActionsScanner.o test_client/client_test/ClassTest.o test_client/client_test/ConfigBase.o test_client/client_test/ConfigHelper.o test_client/client_test/ConfigTest.o test_client/client_test/ConvertString.o test_client/client_test/DirectorJob.o test_client/client_test/DirectorLine.o test_client/client_test/DirectorPid.o test_client/client_test/DirectorProcess.o test_client/client_test/DirectorStat.o test_client/client_test/DirectorTest.o test_client/client_test/Exception.o test_client/client_test/FiltersParser.o test_client/client_test/FiltersScanner.o test_client/client_test/FunctionTable.o test_client/client_test/GcsLib.o test_client/client_test/IntCode.o test_client/client_test/Lib++.o test_client/client_test/Main.o test_client/client_test/RegisterTest.o test_client/client_test/ScriptTest.o test_client/client_test/Servers.o test_client/client_test/SetupTest.o test_client/client_test/SymTab.o test_client/client_test/SyntTree.o test_client/client_test/VM.o test_client/client_test/actionslex.o test_client/client_test/filterslex.o test_client/client_test/actions.o test_client/client_test/filters.o -L/vobs/test_c/thirdparty/RHEL/5u1/jtc/lib -L/vobs/test_c/thirdparty/RHEL/5u1/orbacus/lib -L/vobs/test_c/thirdparty/RHEL/5u1/ldapsdk/lib -L/vobs/test_c/lib ../lib/.libs/libtestWrapper.so -L/users/toolsrd/test/gcc-4.1.2/i686-pc-linux-gnu/libstdc++-v3/src -L/users/toolsrd/test/gcc-4.1.2/i686-pc-linux-gnu/libstdc++-v3/src/.libs -L/users/toolsrd/test/gcc-4.1.2/host-i686-pc-linux-gnu/gcc ../lib/.libs/libtest++.so /users/toolsrd/test/gcc-4.1.2/i686-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so ../lib/.libs/libLdapOpe.so ../lib/.libs/libThreadLib.so ../lib/.libs/libcmnDictionary.so ../lib/.libs/libcmnTrace.so ../lib/.libs/libcmnLib.so ../lib/.libs/libCommandLine.so ../lib/.libs/libXstring.so ../lib/.libs/libRegistry.so ../lib/.libs/libSendInternalAlarm.so ../lib/.libs/libGcsIdlSkel.a ../lib/.libs/libInternalAlarmIdl.a ../lib/.libs/libNtSvcExIdlSkel.a /tools/openbin/cross_gcc_rhes40_rhes50/4.1.2-a1/i486-pc-linux-gnu/lib/libstdc++.so -lm -lc -lgcc_s -lOB -lJTC -lldap50 -lpthread -Wl,--rpath -Wl,/vobs/test_install/Prod/Linux/lib -Wl,--rpath -Wl,/tools/openbin/cross_gcc_rhes40_rhes50/4.1.2-a1/i486-pc-linux-gnu/lib test_client/client_test/ConfigTest.o: In function `ConfigTest::script_(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, ConfigHelper*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)': /vobs/test_c/src/test_client/client_test/ConfigTest.cpp:638: undefined reference to `ylmm::basic_parser<action::expression, ylmm::basic_location, 0, ylmm::basic_lock>:arse(void*)' test_client/client_test/ConfigTest.o: In function `ConfigTest::commandLine_(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, ConfigHelper*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)': /vobs/test_c/src/test_client/client_test/ConfigTest.cpp:593: undefined reference to `ylmm::basic_parser<action::expression, ylmm::basic_location, 0, ylmm::basic_lock>:arse(void*)' /vobs/test_c/src/test_client/client_test/Lib++.cpp:2520: undefined reference to `test::Vector<long>::Vector()' /vobs/test_c/src/test_client/client_test/Lib++.cpp:2520: undefined reference to `test::Vector<long>::Vector()' test_client/client_test/Lib++.o: In function `Libpp::copy(test::Config::AttrValue*, test::Config::FilterLeaf*, test::Config::FilterCmp)': /vobs/test_c/src/test_client/client_test/Lib++.cpp:2463: undefined reference to `test::String<wchar_t>::operator=(test::String<wch ar_t> const&)' /vobs/test_c/src/test_client/client_test/Lib++.cpp:2464: undefined reference to `test::Vector<test::Config::AttrValue>::size() const' /vobs/test_c/src/test_client/client_test/Lib++.cpp:2465: undefined reference to `test::Vector<test::Config::AttrValue>::operator[](unsigned int)' Any issues with this????? I have doubt with PATH and LD_LIBRARY_PATH ? I am not a linux expert. What should PATH and LD_LIBRARY_PATH refers to?????? Please give me the suggestion to get rid this issue..... -- View this message in context: http://www.nabble.com/Migration-from-GCC3.4.3-to-GCC4.1.2-tp23295500p23311623.html Sent from the gcc - Help mailing list archive at Nabble.com.