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 / Linking errors when compiling project, caused by #include <string> ??

Author
Message
Zuko
14
Years of Service
User Offline
Joined: 12th Feb 2010
Location:
Posted: 15th Apr 2010 13:58
Hey guys im working on my 2d game in visual express c++ with dark gdk and im having a problem.

Now basically before i got dark gdk, i had a go at making a command line based game, you know along the lines of press 1 and enter to go here, 2 and enter to there, etc. So when i started using dark GDK to have a go at making a 2d game i decided to reuse some of the files from my console based game. When i added player.h into my dark gdk project and tried to compile i got the following errors:


1>libcpmtd.lib(xdebug.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>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)
1>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)

So i decided the best way to figure out what was causing the error was to comment out certain lines of code, see what happened, turns out that when i commented out the line of code #include <string> and commented out the functions that use strings, it compiled successfully. So does that mean we can't have strings in dark gdk games or am i using incorrect settings etc.

Heres the .h file code



Thanks in advance
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 15th Apr 2010 18:27
Search the boards for linker error. This is a fairly common problem. I don't remember the specifics or I'd tell ya now.

JTK
Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 15th Apr 2010 19:42
Goto project > properties then goto configuration properties and then click on c/c++ then click on Code Generation. change the runtime library from multi threaded debug to multi threaded.

Your signature has been erased by a mod - Please reduce it to 600x120 maximum size
Zuko
14
Years of Service
User Offline
Joined: 12th Feb 2010
Location:
Posted: 16th Apr 2010 02:52
Thanks guys, sorry I should have searched the forums first. From reading the thread by tempicek on the issue, my impression of the problem is that, Dark GDK only comes with release version libraries not debug, so i'm assuming that the release libraries from Dark GDK are conflicting with the debug library versions of string... or something like that. Anyway i'll give Marsh0's solution a try when i get home and reply with how it goes.

I just want to check though, when I change the run time library from MTD to MT what gets cuts out, anything important?

Login to post a reply

Server time is: 2024-10-02 03:25:39
Your offset time is: 2024-10-02 03:25:39