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 / Including a class, very new to c++

Author
Message
odiggity
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location:
Posted: 21st Apr 2008 07:22
Hi,
I am trying to include a very basic class with my dark GDK program. The header looks like this,


My program works fine without this class but as soon as I include it I get the following 5 unresolved external symbol errors. What is going on?

-----------------------errors-----------------------

Error 2 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) libcpmtd.lib


Error 3 error LNK2001: unresolved external symbol __CrtDbgReportW libcpmtd.lib

Error 4 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

Error 5 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) libcpmtd.lib

Error 6 error LNK2019: unresolved external symbol __calloc_dbg referenced in function __Getctype libcpmtd.lib
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 21st Apr 2008 08:34
That usually comes only in debug mode. If you can compile it in release mode then the problem is that you need to go into the project settings of the debug compile and set the c/c++ code generation runtime library to /MT instead of /MTd.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
bobba
16
Years of Service
User Offline
Joined: 10th Apr 2008
Location:
Posted: 28th Apr 2008 16:04
It could be because you are calling #include<iostream>, i am not 100% on this but if you have alreddy called <iostream> in main you may be calling it again when you include your object.

I sugest tacking out all funcinality, than adding back the functions one at a time untill you see what is causing the problem



also try tacking out the #pragma once


then put these 2 lines at the top

#ifndef NOTE
#define NOTE


and this one at the very bottom

#endif
Pashapook
16
Years of Service
User Offline
Joined: 28th Apr 2008
Location:
Posted: 29th Apr 2008 06:17
Im not real great at c++ my self but dont you need an override:

Note(void);
Note(int vPos, int hPos, char type);
~Note(void);

just a guess...and it is how I Got it to compile on my PC
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 29th Apr 2008 06:30
Quote: "It could be because you are calling #include<iostream>, i am not 100% on this but if you have alreddy called <iostream> in main you may be calling it again when you include your object."


That shouldn't be the issue. Including a header twice, especially a system header, shouldn't cause such a conflict. It should include at least a #pragma to only be included once or other preprocessor directives to prevent the same. Calling an include twice without such protection would likely cause the compiler to complain or warn about redefines but shouldn't cause a library conflict.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 29th Apr 2008 12:53
I'm not sure what the problem is but never use using namespace in a header as it'll enable it for all files that include this header.

Login to post a reply

Server time is: 2024-11-20 09:26:15
Your offset time is: 2024-11-20 09:26:15