./TestCppProgram: symbol lookup error: ./TestCppProgram: undefined symbol: _ZN12CppProgramC1EvI searched the internet. Two of the interesting links I found were the following:
- http://osdir.com/ml/gcc.g++.general/2005-02/msg00061.html
- http://www.linuxquestions.org/questions/linux-software-2/undefined-symbol-cout-263568/
Some cool commands in the debugging process:
- ldd TestCppProgram (Shows you where your program is getting it's libraries from. An early-on careful inspection of this would've quickly let me to my problem!)
- ldd -d -r TestCppProgram (Shows you any undefined symbols. There shouldn't be any undefined symbols for an executable, but there will be for a shared lib if it depends on another shared lib. Somebody please correct me if I'm wrong)
- nm TestCppProgram | c++filt (displays unmangled symbol information)
- nm TestCppProgram (Displays mangled symbol information. Ie: You should be able to find stuff like ZN12CppProgramC1Ev in here. In my problem above, I found which line number the undefined symbol in question was on, and then looked it up in the unmangled version to see what function it was trying to resolve. It let me know, but it didn't really help me find out what my problem was.)
- readelf -d TestCppProgram (Shows library dependencies. similar to ldd.)
14 comments:
Hey I had forgotten to write a destructor..
nm with c++filt is awesome!
Just the thing I needed
Thanks.. :)
nm -C does the same as filtering through c++filt
great post, you saved the day for me today!
This is a very nicely written post with all of the necessary detail for starting with these tools. Thanks!
Really helpful article. Thanks a lot.
Great tip, indeed! Thanks!
Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man,Keep it up. Bin lookup
Really good abstract from both the websites
Thanks for these suggestions, you saved me ton of time.
Hey really useful stuff, you saved my time. I was compiling against an older version of library and the target has a different version of the same library.
Wow that tremendously helped me out. I had to work with the mongo cxx driver and it turns out the executable was built referencing a mongo library that was built with boost. The executable wouldn't run on another computer with mongo library built without boost.
That being said, I'll walk your dogs, get your dry cleaning for a week if you'd like me to. THANKS SO MUCH!!
I’m impressed, I need to say. Really hardly ever do I encounter a weblog that’s each educative and entertaining, and let me tell you, you will have hit the nail on the head. Your concept is excellent; the difficulty is one thing that not sufficient people are speaking intelligently about. I am very completely happy that I stumbled throughout this in my search for one thing referring to this. online casino
Post a Comment