I tried to do a simple file reading example today using ofstream and i noticed that it gives me linker errors. Here's the code
#include "DarkGDK.h"
#include <iostream>
#include <fstream>
using namespace std;
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
dbMakeObjectCube(1,1);
while ( LoopGDK ( ) )
{
dbXRotateObject(1,dbObjectAngleX(1)+1);
dbSync ( );
}
return;
}
And here's what VS ouputs:
1>------ Build started: Project: editor_fstream, Configuration: Debug Win32 ------
1>Compiling...
1>Main.cpp
1>Linking...
1>libcpmtd.lib(xdebug.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Main.obj : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: char const & __thiscall std::_String_const_iterator<char,struct std::char_traits<char>,class std::allocator<char> >::operator*(void)const " (??D?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDXZ)
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>libcpmtd.lib(_tolower.obj) : error LNK2019: unresolved external symbol __calloc_dbg referenced in function __Getctype
1>Debug\editor_fstream.exe : fatal error LNK1120: 4 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Bacioiu Ciprian\My Documents\Visual Studio 2008\Projects\editor_fstream\editor_fstream\Debug\BuildLog.htm"
1>editor_fstream - 6 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========