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 / VC2008 expression compiling error ( using STL )

Author
Message
Lion Jin
18
Years of Service
User Offline
Joined: 24th Sep 2006
Location:
Posted: 28th Nov 2007 04:46 Edited at: 28th Nov 2007 04:50
When I used VC2008 expression , If I used STL ( list ,vector…) in my codes ,the compiler will give the error message like below ,but no problem in release mode, only debug mode .The problem never occurred when I used VC2003 or VC2005 to compile the same codes.

Sorry for my poor english ,any help would be great ,thanks!

1>------ Build started: Project: GoldenStar, Configuration: Debug Win32 ------
1>Linking...
1>libcpmtd.lib(xdebug.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>button.obj : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: class BUTTON * const & __thiscall std::list<class BUTTON *,class std::allocator<class BUTTON *> >::_Const_iterator<1>::operator*(void)const " (??D?$_Const_iterator@$00@?$list@PAVBUTTON@@V?$allocator@PAVBUTTON@@@std@@@std@@QBEABQAVBUTTON@@XZ)
1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
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)
1>DebugGoldenStar.exe : fatal error LNK1120: 3 unresolved externals
1>Build log was saved at "file://d:myWorksGoldenStarGoldenStarDebugBuildLog.htm"
1>GoldenStar - 5 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Below is the sample code:

#include "DarkGDK.h"
#include <list>
#include <algorithm>

typedef std::list<BUTTON*> ButtonIterator;

ButtonIterator::iterator ButtonIt; //iterator for button list

std::list< BUTTON* > ButtonList; //list for button


// constructor
BUTTON::BUTTON()
{
ButtonList.push_back(this);
}
Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 28th Nov 2007 21:38
I had a similar problem in VC++ 2005 where for some reason on occasions the Linker tries to link mixtures of run time and debug libraries.

I took Microsoft's advice and excluded the following libraries on a DEBUG build as follows:

Open your Solution/Project's Configuration properties
Go to the Linker settings
In the Input section under Ignore specific libraries add the following:

atls.lib, libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib

This cured my problem.

No matter how good your code is, someone will improve on it
Lion Jin
18
Years of Service
User Offline
Joined: 24th Sep 2006
Location:
Posted: 29th Nov 2007 02:56
Thanks, that solved my problem ,thank you!
Lion Jin
18
Years of Service
User Offline
Joined: 24th Sep 2006
Location:
Posted: 29th Nov 2007 07:30
Sorry ,I found this way ( Ignore specific libraries:atls.lib, libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib) only works for VC2005 ,but not works for VC2008 expression.
Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 29th Nov 2007 11:20
Sorry Jin but I have not felt the need to upgrade to VC++ 2008 yet so I can't help you any further.

All I can suggest is looking at the help on the LNK errors to see if it gives any suggestions there. It may be that 2008 has introduced some new libraries which may need adding to the exclusions!

No matter how good your code is, someone will improve on it
Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 29th Nov 2007 11:42
Lion Jin, to solve this problem change your code generation from multi threaded debug to multi threaded.
Lion Jin
18
Years of Service
User Offline
Joined: 24th Sep 2006
Location:
Posted: 30th Nov 2007 03:03
Thanks Jonhson and Pixel Perfect ,It works for now
Slow Target
16
Years of Service
User Offline
Joined: 10th Jan 2008
Location:
Posted: 27th Jan 2008 22:34
I seem to have the same problem. where do I
Quote: "change your code generation from multi threaded debug to multi threaded."


I'm using VC2008 express.

TIA
Slow Target
16
Years of Service
User Offline
Joined: 10th Jan 2008
Location:
Posted: 27th Jan 2008 22:54
Never mind, I found it and it works! Thanks.

for the record, for a project named "Dark GDK - Game4"

in the solution explorer, just under Solution 'dark GDK' (1project)

right click on "Dark GDK - Game4"

under configuration properties
C/C++
CodeGeneration
change Runtime Library to Multi-threaded(/MT)

Login to post a reply

Server time is: 2024-09-29 05:31:49
Your offset time is: 2024-09-29 05:31:49