## Recommended Posts

Mizipzor    247
When I try to compile my project I get this:
Linking...
SdlWrapper.obj : error LNK2019: unresolved external symbol "public: static void __cdecl Log::Write(class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &)" (?Write@Log@@SAXABV?$basic_string@DU?$char_traits@D@std@@V?\$allocator@D@2@@std@@@Z) referenced in function "public: bool __thiscall SdlWrapper::SetRes(int,int,int)" (?SetRes@SdlWrapper@@QAE_NHHH@Z)
Debug/TicTacToe.exe : fatal error LNK1120: 1 unresolved externals


Log is a logging class I have. And SdlWrapper is... well a wrapper for sdl. :P Other than that, I dont really know what wrong or where to look.

##### Share on other sites
SiCrane    11839
It sounds pretty straighforward to me. The linker says you didn't define your Log::Write(const std::string&) function.

##### Share on other sites
Mizipzor    247
But I did :P. Here it is:

void Log::Write(const string& logEntry){	if(screenWrite)	{		printf("%s\n", logEntry.c_str());	}	if(fileWrite)	{		log_file << logEntry.c_str() << endl;	}}

##### Share on other sites
Guest Anonymous Poster
Somewhere, though, you should have it defined as a function prototype.

I don't know C++ (C only) so I don't know what the :: are - something to do with inheritance maybe - but you should have something like (overly complex example, so as to demonstrate the problem):

void Log::Write(const string& logEntry);

Somewhere, as a definition of the function. If it's external (won't be available to the C++ compiler, but will be to the linker - say an assembler function or something already compiled to object code) then you'll need something like:

extern void Log::Write(const string& logEntry);

As I say, I don't know C++ at all, so the syntax in terms of those :: might be different.