Jump to content


C++ unresolved external symbol

  • Please log in to reply
No replies to this topic

#1 Demonslay


    P2L Jedi

  • Members
  • PipPipPip
  • 973 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 03 December 2007 - 07:36 PM

Ok, I've been working with C++ for some time, and whenever I try to use some kind of API (currently trying to do a networked game with the Winsock library), I get the following error for just about every function in the linker.

project.obj : error LNK2019: unresolved external symbol _function_name@12 referenced in function "public: void __thiscall class_name::method_name(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?method_name@class_name@@QAEXV?$[email protected]?$[email protected]@[email protected]@V?$[email protected]@[email protected]@[email protected]@@Z)

I've done plenty of Google'ing, and all I can find are people saying you need to make sure all the needed files are included. I have '#include <winsock.h>' at the top of my main file, before my classes and methods are compiled. I know it is being included correctly, because the IntelliSense is working properly for showing me the function and type definitions, and if I take the line out it gives me the 'undeclared identifier' error.

This has been driving me insane, and I'm so sick of this error coming up on just about any project I compile that depends on anything other than the simple std libraries just about. :)

I use Visual C++ 2005 Express Edition for my compiler, and my experience is so-so in C++; I come from heavy PHP experience though.

Ok, I did a little further research today in class, and finally found how to fix it! I reduced it down last night to having to somehow link the ws2_32.lib library file to my compiler, but had no clue how. Finally found out how, linked it, and all works fine. :)
For anyone else who might have this problem, refer to this post, and simply add 'ws2_32.lib' to the 'Additional Dependencies' value and all should be good to go. :D

Edited by Demonslay, 04 December 2007 - 05:54 PM.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users