Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Nasty error

Author
Message
Serain
18
Years of Service
User Offline
Joined: 17th Jul 2006
Location:
Posted: 10th Jul 2009 23:05
Hello,
I'm stuck on a nasty error. I've been on it for 2 hours and my nerves are going to explode!

Here is the log:
Quote: "------ Build started: Project: Triple, Configuration: Debug Win32 ------
Linking...
libcpmtd.lib(xdebug.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
Debug\TripleTriad.exe : fatal error LNK1120: 2 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Node-Langlois\Mes documents\Visual Studio 2008\Projects\Triple\Triple\Debug\BuildLog.htm"
Triple - 3 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
"


Some info on the program:
2 simple classes
uses string library
doesn't make use of darkGDK functions yet

It's the first time I see this error and my program is really simple at the moment. I really don't understand how this bugger got here.

Any guidance as to where and what kind of error I should look for would help me. Or even just translating what the compiler is trying to tell me (the only thing I understand is that the problem involves libraries).
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 10th Jul 2009 23:10 Edited at: 10th Jul 2009 23:13
This usually happens when using STL containers.

To fix it:

Project->!Project_Name! Properties...->[+]Configuration Properties->[+]C/C++->Code Generation

Change the Runtime Library to /MT instead of /MTd

Click OK.

It should compile fine now.

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
Serain
18
Years of Service
User Offline
Joined: 17th Jul 2006
Location:
Posted: 10th Jul 2009 23:37 Edited at: 10th Jul 2009 23:42
Perfect! Thanks alot!
I would have never found hehe.

Instead of starting a new post I will add a question here:

I programmed in C++ under Linux at school and our teachers taught us to declare a class in a .h but to define the functions in a .cpp with the same name.
When defining the function in the .cpp we would go:

void ClassName::FunctionName() { ... }

but VC++ doesn't like that. Whenever I tried that syntax he gave me errors and I ended up defining all my functions in the .h file.

Is there another better way or is this just how I'm going to have to program in windows?
Iuzidal
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location:
Posted: 11th Jul 2009 01:25
That syntax is correct. What was the error?
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 11th Jul 2009 03:51
Did you make sure the .h file was included?

Login to post a reply

Server time is: 2024-11-25 06:36:27
Your offset time is: 2024-11-25 06:36:27