Visual Studio Strange Exception

Visual Studio Strange Exception

本文关键字:Exception Strange Studio Visual      更新时间:2023-10-16

我将一个项目从Visual Studio Express(Windows SDK x64 with CMake)移植到Visual Studio 2010 Professional(针对x64编译)。一切似乎都正常。我可以编译我转换的.dll项目。进入我的测试项目时,我面临着一种奇怪的行为。(链接/包含库的设置方式相同)。

编辑 发布/调试也会发生同样的情况。

我收到以下错误(当我在Visual Studio 2010中运行代码时):

 KernelBase.dll!RaiseException()  + 0x3d bytes  
 msvcr100.dll!_CxxThrowException()  + 0x81 bytes    
 000007fe8d54a043() 
 000007fe8d548700() 
 000007fe8d547d20() 
 000007fe8d547cee() 
 000007fe8d547c79() 
 clr.dll!000007feecbc822e()     
 [Frames below may be incorrect and/or missing, no symbols loaded for clr.dll]  
 kernel32.dll!BaseThreadInitThunk()  + 0xd bytes    
 ntdll.dll!RtlUserThreadStart()  + 0x21 bytes

多亏了这些家伙帮我调试,问题才得以解决。。。

所以交易是这样的:

我正在创建多个输出窗口。他们每个人都有不同的线索。在初始化部分,我有以下代码:

  m_wndclassName = L"Output App"; // Here's the bug, the names should be different ...
  m_wndclass.style         = 0;
  m_wndclass.lpfnWndProc   = (WNDPROC)OpenGLSinkNode::wndProc;
  m_wndclass.cbClsExtra    = 0;
  m_wndclass.cbWndExtra    = 0;
  m_wndclass.hInstance     = NULL;
  m_wndclass.hIcon         = LoadIcon(NULL, m_wndclassName.c_str());
  m_wndclass.hCursor       = LoadCursor(NULL, IDC_ARROW);
  m_wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
  m_wndclass.lpszMenuName  = m_wndclassName.c_str();
  m_wndclass.lpszClassName = m_wndclassName.c_str();

解决方案:

  m_wndclassName = L"Output App"; + std::to_wstring( (long double)m_id); // watch out here because std::to_wstring() has a bug ... you have to cast it to (long double), my_id of type int (Only in VS 2010, I read.)