Hi,
I have what I consider to be a serious problem with DarkGDK. I am largely an OO programmer and as such I make regular use of standard libraries such as vector.
I also wish to make use of some third party libraries that use vector and list so I kind of need them to work.
When I try to use a vector with the GDK I get a load of build errors. Here is what I mean...
#include "DarkGDK.h"
void DarkGDK(void)
{
dbSyncOn( );
dbSetDisplayMode(640, 480, 32);
dbSetWindowOn();
dbSyncRate(60);
dbMakeObjectCube(1,10);
while (LoopGDK())
{
if (dbEscapeKey())
{
return;
}
dbRotateObject(1, dbObjectAngleX(1) + 0.1f, dbObjectAngleY(1) + 0.1f, dbObjectAngleZ(1) + 0.1f );
dbSync();
}
}
... works fine although the linker settings seem to have to be set to ignore the msvcrt, atls and libcmtd libraries. It was like this when it came out of the box and projects are generated like this when you use one of the GDK wizards.
Now if you try to add a vector (or as it seems any standard library (iostream, fstream, sstream...) as below...
#include "DarkGDK.h"
#include <vector>
void DarkGDK(void)
{
dbSyncOn( );
dbSetDisplayMode(640, 480, 32);
dbSetWindowOn();
dbSyncRate(60);
dbMakeObjectCube(1,10);
std::vector<int> testVec;
while (LoopGDK())
{
if (dbEscapeKey())
{
return;
}
dbRotateObject(1, dbObjectAngleX(1) + 0.1f, dbObjectAngleY(1) + 0.1f, dbObjectAngleZ(1) + 0.1f );
dbSync();
}
}
... you get the following fatal build errors...
1>Linking...
1>libcpmtd.lib(xdebug.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>libcpmtd.lib(stdthrow.obj) : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z)
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>.\Debug/Example 1.exe : fatal error LNK1120: 3 unresolved externals
I noticed that the first warning is about libcmt so I tried changing the library excludes to msvcrt, atls, libcmt (libcmtd changed to libcmt) and that resulted in even more errors so I tried msvcrt, atls, libcmt, libcmtd resulting in over 1000 link errors so I am guessing that isn't the solution
I have also after searching this forum for tips tried changing the run time type from Multi Threaded Debug (MTd) to Multi Threaded Debug DLL (MDd) to Multi Threaded (MT) to Multi Threaded DLL (MD) and none of them build.
This is causing me great frustration at the moment, It looks like DarkGDK has something about it which is incompatible with the use of some of the most helpful functionality that c++ has to offer!!
I really hope I am missing a trick here, If I cant use this stuff then not only are some of my favorite design patterns hamstrung but all the tool classes I have written as helpers are a write off!
Does anybody have any suggestions to getting this to build (and work) with standard libraries like vector and list??
I will give this a couple of days on the forum and then if not resolved take it up with TGC as a tech support issue.
Cheers
MACRO