Visual Studio奇怪的例外

时间:2013-11-21 13:46:08

标签: c++ visual-studio-2010 winapi cmake

我将一个项目从Visual Studio Express(带有CMake的Windows SDK x64)移植到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

1 个答案:

答案 0 :(得分:0)

问题解决了,感谢帮助我完成调试的人......

所以这是交易:

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

  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.)