siv*_*udh 5 c++ dll compiler-warnings dllexport
当我尝试将以下函数导出为dll时:
extern "C" __declspec(dllexport) void some_func()
{
throw std::runtime_error("test throwing exception");
}
Run Code Online (Sandbox Code Playgroud)
Visual C++ 2008给了我以下警告:
1>.\SampleTrainer.cpp(11) : warning C4297: 'some_func' : function assumed not to throw an exception but does
1> The function is extern "C" and /EHc was specified
Run Code Online (Sandbox Code Playgroud)
我需要extern"C",因为我使用Qt QLibrary加载DLL并解析函数名称.没有extern"C"就找不到some_func()函数.
如果您决心执行编译器警告您的操作,为什么不直接取消警告呢?
#pragma warning(disable: 4247)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3831 次 |
| 最近记录: |