c++ - wxWidgets 和 VC++

标签 c++ visual-c++ wxwidgets

我今天决定熟悉一下wxWidgets。 我下载了版本 2.8.9(当前版本),并以所有所需的模式编译了该库。

我能够构建/运行 wxWidgets 开箱即用的示例。 然而,当我使用 /Za 进行编译(即禁用语言扩展)时,即使是最小的 wxWidgets 示例,我也会遇到 100 多个构建错误。

我找不到有关此问题的任何文档。我可以定义一些东西来将 wxWidget 的内部结构切换为符合标准(至少就 VC++ 的合规性而言)吗?

也许我在构建原始库时做错了什么......以前有人遇到过这个“问题”吗?

谢谢!

编辑:我忘了提及我正在使用 VC++ 9。

此外,这里是前几个错误:

------ Build started: Project: minimal, Configuration: Unicode Debug Win32 ------

Compiling...

minimal.cpp

c:\wxWidgets-2.8.9\include\wx/dynarray.h(69) : error C2143: syntax error : missing ')' before '*'

c:\wxWidgets-2.8.9\include\wx/dynarray.h(69) : error C2143: syntax error : missing ';' before '*'

c:\wxWidgets-2.8.9\include\wx/dynarray.h(69) : error C2059: syntax error : ')'

c:\wxWidgets-2.8.9\include\wx/dynarray.h(69) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

c:\wxWidgets-2.8.9\include\wx/dynarray.h(810) : error C2146: syntax error : missing ';' before identifier 'SCMPFUNC'

c:\wxWidgets-2.8.9\include\wx/dynarray.h(810) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

c:\wxWidgets-2.8.9\include\wx/dynarray.h(810) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

c:\wxWidgets-2.8.9\include\wx/dynarray.h(811) : error C2146: syntax error : missing ';' before identifier 'SCMPFUNC'

c:\wxWidgets-2.8.9\include\wx/dynarray.h(811) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

c:\wxWidgets-2.8.9\include\wx/dynarray.h(811) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

编辑:看起来第一个错误是由使用 _cdecl 引起的。看起来 defs.h 仅检查 __VISUALC__ 是否已定义。没有任何迂腐的迹象......

最佳答案

您可能会发现,您甚至无法使用 /Za 构建基本的 Win32 应用程序,更不用说 wxWidgets 应用程序了,因为 VS2008 中包含的 Windows Platform SDK header 使用语言扩展。唯一的解决方案是禁用 /Za

您看到的具体错误是因为 _cdecl 关键字是 Microsoft 扩展,而不是标准 C++ 的一部分。 欲了解更多信息,请参阅documentation for /Za ,以及 Microsoft Extensions to C and C++C++ Keywords MSDN 中的页面。

关于c++ - wxWidgets 和 VC++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/599195/

相关文章:

c++ - 立即调用 OnMove() 而不是等待窗口的实际移动

c++ - 尝试编译我的wxWidgets程序时出现 “is_enum not declared in this scope”错误

visual-c++ - wxWidgets wxWinCE 挂起-恢复崩溃(VC++)

java - 使用 LLVM 运行 javacpp 预设时出现 UnsatisfiedLinkError

c++ - 如何自动将ID属性分配给C++中的类对象

c++ - 如何设置发布/ Debug模式以使用 Microsoft C++ 工具集在命令提示符下编译 cpp 文件

非控制台应用程序项目中的 C++ 控制台

linux - 如何解决编译错误--makefile

c++ - 多线程深度复制

c++ - 为枚举参数化的模板