I keep getting errors when i try and use the vector class I have an object
vector<CSquare*>m_OldSquare;
however when i try and add elements to the list

CSquare** tempArray = m_FocusBlock->GetSquares();

	for(int i=0; i<4; i++)
	{
		m_OldSquares.push_back(tempArray[i]);	
	}

I get this error

unresolved external symbol __imp___CrtDbgReportW referenced in function "public: __thiscall std::_Vector_const_iterator<class CSquare *,class std::allocator<class CSquare *> >::_Vector_const_iterator<class CSquare *,class std::allocator<class CSquare *> >(class CSquare * *,class std::_Container_base const *)" (??0?$_Vector_const_iterator@PAVCSquare@@V?$allocator@PAVCSquare
@@@std@@@std@@QAE@PAPAVCSquare@@PBV_Container_base@1@@Z)
1>C:\\SDLBlox\Debug\SDLBlox.exe : fatal error LNK1120: 1 unresolved externals

also when i want to delete all elements in the list on exit

for(int i=0;i<m_OldSquares.size(); i++)
     delete m_OldSquares[i];

I get similar errors.
I don't really know what i'm doing wrong any help would be greatly appreciated

Recommended Answers

All 5 Replies

It is some sort of project configuration mismatch, you could post the complete command line of the compiler. Try looking in Project/Properties/Configuration Properties/C/C++/Command Line.

/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MD /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt

/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MD /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt

Since you are doing a debug build, the "/MD" -option does not match. Open:

Project/Properties/Configuration Properties/C/C++/Code Generation

and change the option "Runtime Library" to:

"Multi-threaded Debug DLL (/MDd)"

Thanks it builds now but i got this warning
warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
I'm using SDL thats why i changed the runtime library to MD.
Is there anything i can do to not get the conflict but still compile the program

You might compile the SDL from source hence having complete control over the run-time library usage. You should not use a mixed combination of the libraries (i.e. static/dynamic/debug/release ...).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.