G
Guest
The following program will result in a compile error when building under Debug but will compile under Release. Why does is work under Release mode but not under Debug
This program is developed under Visual Studio .NET 2003 in a Win32 Console Project
// VectorInsert.cpp : Defines the entry point for the console application
/
#include "stdafx.h
#include "VectorInsert.h
#ifdef _DEBU
#define new DEBUG_NE
#endi
#include <vector
#include <string
#include <map
void addToVector(std::vector<std::string>& out_Vector, std::string in_sValue)
// The one and only application objec
CWinApp theApp
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]
int nRetCode = 0
// initialize MFC and print and error on failur
if (!AfxWinInit:GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)
// TODO: change error code to suit your need
_tprintf(_T("Fatal Error: MFC initialization failed\n"))
return 1
std::vector<std::string> loc_Vector1, loc_Vector2
std::map<std::string, std::map<std::string, std::vector<std::string>>> loc_Map
addToVector(loc_Map["GENERIC"]["GENERIC"], "GENERIC")
std::vector<std::string>::iterator loc_Iter
loc_Vector2 = loc_Map["GENERIC"]["GENERIC"]
for (loc_Iter = loc_Vector2.begin(); loc_Iter != loc_Vector2.end(); loc_Iter++)
std::cout << (*loc_Iter).c_str() << std::endl
return nRetCode
void addToVector(std::vector<std::string>& out_Vector, std::string in_sValue)
std::vector<std::string> loc_Vector1, loc_Vector2
loc_Vector1.push_back("Hello World")
loc_Vector1.push_back("How are you?")
loc_Vector1.push_back("Keep on smiling!")
loc_Vector2.push_back("Time to go")
loc_Vector2.push_back("Take care")
loc_Vector2.push_back("Goodbye World!")
loc_Vector1.insert(loc_Vector1.end(), loc_Vector2.begin(), loc_Vector2.end())
std::vector<std::string>::iterator loc_Iter
for (loc_Iter = loc_Vector1.begin(); loc_Iter != loc_Vector1.end(); loc_Iter++)
std::cout << (*loc_Iter).c_str() << std::endl
std::cout << std::endl << "End of addToVector()" << std::endl << std::endl
out_Vector = loc_Vector2
The error displayed is
Compiling..
VectorInsert.cp
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xtree(1133) : error C2061: syntax error : identifier '_Wherenode
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xtree(1130) : while compiling class-template member function 'std::_Tree<_Traits>::_Nodeptr std::_Tree<_Traits>::_Buynode(std::_Tree<_Traits>::_Nodeptr,std::_Tree<_Traits>::_Nodeptr,std::_Tree<_Traits>::_Nodeptr,const std::_Tree<_Traits>::value_type &,char)
wit
_Traits=std::_Tmap_traits<std::string,std::map<std::string,std::vector<std::string>>,std::less<std::string>,std::allocator<std:air<const std::string,std::map<std::string,std::vector<std::string>>>>,false
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\map(77) : see reference to class template instantiation 'std::_Tree<_Traits>' being compile
wit
_Traits=std::_Tmap_traits<std::string,std::map<std::string,std::vector<std::string>>,std::less<std::string>,std::allocator<std:air<const std::string,std::map<std::string,std::vector<std::string>>>>,false
d:\TestVisualC++\J13 Tests\VectorInsert\VectorInsert\VectorInsert.cpp(35) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compile
wit
_Kty=std::string
_Ty=std::map<std::string,std::vector<std::string>
Build log was saved at "file://d:\TestVisualC++\J13 Tests\VectorInsert\VectorInsert\Debug\BuildLog.htm
VectorInsert - 1 error(s), 0 warning(s)
This program is developed under Visual Studio .NET 2003 in a Win32 Console Project
// VectorInsert.cpp : Defines the entry point for the console application
/
#include "stdafx.h
#include "VectorInsert.h
#ifdef _DEBU
#define new DEBUG_NE
#endi
#include <vector
#include <string
#include <map
void addToVector(std::vector<std::string>& out_Vector, std::string in_sValue)
// The one and only application objec
CWinApp theApp
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]
int nRetCode = 0
// initialize MFC and print and error on failur
if (!AfxWinInit:GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)
// TODO: change error code to suit your need
_tprintf(_T("Fatal Error: MFC initialization failed\n"))
return 1
std::vector<std::string> loc_Vector1, loc_Vector2
std::map<std::string, std::map<std::string, std::vector<std::string>>> loc_Map
addToVector(loc_Map["GENERIC"]["GENERIC"], "GENERIC")
std::vector<std::string>::iterator loc_Iter
loc_Vector2 = loc_Map["GENERIC"]["GENERIC"]
for (loc_Iter = loc_Vector2.begin(); loc_Iter != loc_Vector2.end(); loc_Iter++)
std::cout << (*loc_Iter).c_str() << std::endl
return nRetCode
void addToVector(std::vector<std::string>& out_Vector, std::string in_sValue)
std::vector<std::string> loc_Vector1, loc_Vector2
loc_Vector1.push_back("Hello World")
loc_Vector1.push_back("How are you?")
loc_Vector1.push_back("Keep on smiling!")
loc_Vector2.push_back("Time to go")
loc_Vector2.push_back("Take care")
loc_Vector2.push_back("Goodbye World!")
loc_Vector1.insert(loc_Vector1.end(), loc_Vector2.begin(), loc_Vector2.end())
std::vector<std::string>::iterator loc_Iter
for (loc_Iter = loc_Vector1.begin(); loc_Iter != loc_Vector1.end(); loc_Iter++)
std::cout << (*loc_Iter).c_str() << std::endl
std::cout << std::endl << "End of addToVector()" << std::endl << std::endl
out_Vector = loc_Vector2
The error displayed is
Compiling..
VectorInsert.cp
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xtree(1133) : error C2061: syntax error : identifier '_Wherenode
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xtree(1130) : while compiling class-template member function 'std::_Tree<_Traits>::_Nodeptr std::_Tree<_Traits>::_Buynode(std::_Tree<_Traits>::_Nodeptr,std::_Tree<_Traits>::_Nodeptr,std::_Tree<_Traits>::_Nodeptr,const std::_Tree<_Traits>::value_type &,char)
wit
_Traits=std::_Tmap_traits<std::string,std::map<std::string,std::vector<std::string>>,std::less<std::string>,std::allocator<std:air<const std::string,std::map<std::string,std::vector<std::string>>>>,false
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\map(77) : see reference to class template instantiation 'std::_Tree<_Traits>' being compile
wit
_Traits=std::_Tmap_traits<std::string,std::map<std::string,std::vector<std::string>>,std::less<std::string>,std::allocator<std:air<const std::string,std::map<std::string,std::vector<std::string>>>>,false
d:\TestVisualC++\J13 Tests\VectorInsert\VectorInsert\VectorInsert.cpp(35) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compile
wit
_Kty=std::string
_Ty=std::map<std::string,std::vector<std::string>
Build log was saved at "file://d:\TestVisualC++\J13 Tests\VectorInsert\VectorInsert\Debug\BuildLog.htm
VectorInsert - 1 error(s), 0 warning(s)