STL code does not compile in manged C++ test project. - by Alexey99

Status : 

  Deferred<br /><br />
		The product team has reviewed this issue and has deferred it for consideration at a later time.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 590287 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 8/27/2010 4:33:20 PM
Access Restriction Public

Description

Following code in a test project does not compile:

[TestMethod]
void test_lis()
{
	vector<int> vSeq;

	int seq[] = {7, 8, 2, 3, 4}; // 2, 3, 4
	vSeq = vector<int>(seq, seq + sizeof(seq)/sizeof(int));
	Assert::AreEqual(3, CAlgorithms::lis(vSeq), "LIS Length");
}

Error	1	error LNK2028: unresolved token (0A00010D) "extern "C" int __cdecl _CrtDbgReportW(int,wchar_t const *,int,wchar_t const *,wchar_t const *,...)" (?_CrtDbgReportW@@$$J0YAHHPB_WH00ZZ) referenced in function "public: int const & __thiscall std::_Vector_const_iterator<class std::_Vector_val<int,class std::allocator<int> > >::operator*(void)const " (??D?$_Vector_const_iterator@V?$_Vector_val@HV?$allocator@H@std@@@std@@@std@@$$FQBEABHXZ)	D:\P\Exercises\TestAlgorithms\TestAlgorithms.obj

Error	2	error LNK2019: unresolved external symbol "extern "C" int __cdecl _CrtDbgReportW(int,wchar_t const *,int,wchar_t const *,wchar_t const *,...)" (?_CrtDbgReportW@@$$J0YAHHPB_WH00ZZ) referenced in function "public: int const & __thiscall std::_Vector_const_iterator<class std::_Vector_val<int,class std::allocator<int> > >::operator*(void)const " (??D?$_Vector_const_iterator@V?$_Vector_val@HV?$allocator@H@std@@@std@@@std@@$$FQBEABHXZ)	D:\P\Exercises\TestAlgorithms\TestAlgorithms.obj

Error	3	error LNK1120: 2 unresolved externals	D:\P\Exercises\Debug\DefaultTest.dll	1


vs. similar code that does compile:

[TestMethod]
void test_lis()
{
	//vector<int> vSeq;

	int seq[] = {7, 8, 2, 3, 4}; // 2, 3, 4
	vector<int> vSeq = vector<int>(seq, seq + sizeof(seq)/sizeof(int));
	Assert::AreEqual(3, CAlgorithms::lis(vSeq), "LIS Length");
}
Sign in to post a comment.
Posted by Microsoft on 9/22/2010 at 4:30 PM
Hi,

Thanks for reporting this issue. We have been able to reproduce it and we are investigating it. It turns out that its not STL, rather this is an IDE issue for Test Projects. The IDE is supposed to set /MDd switch by default for Debug configurations which is not happening here. While we look into this further, you can unblock your work by manually setting the runtime library option to use /MDd.

<Project properties>
C/C++ --> Code Generation --> Runtime Library = "Multi-threaded Debug DLL (/MDd)".

We will update you with more details about this issues resolution timeframe soon.

Feel free to email me at mohammad.usman@microsoft.com if you have any questions/concerns.

Mohammad Usman
Visual C++ Libraries Team
Posted by Microsoft on 8/27/2010 at 5:03 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)