资料来源于网络整理
最近用Qt5.2.0版本编译Windows下代码,发现编译错误
D:\Qt\Qt5.2.0\5.2.0\msvc2012\include\QtCore\qdatetime.h:122:error: C2589: “(”:“::”右边的非法标记
D:\Qt\Qt5.2.0\5.2.0\msvc2012\include\QtCore\qdatetime.h:122:error: C2059: 语法错误:“::”
错误代码如下:
staticinlineqint64nullJd(){returnstd::numeric_limits<qint64>::min();}
一时间不知所云,google之
应该是系统函数与Qt的min函数冲突导致的,修改如下,添加括号
staticinlineqint64nullJd(){return(std::numeric_limits<qint64>::min)();}
QT在Windows下编译还有很多小问题,比如有的时候代码其实没有编译,必须删除debug和release目录之后才会重新编译。
最后环境变量Path: D:\CGAL\x64_build\bin
Appendix: How to Set the PATH Variableor Other Environment Variables on Windows Systems
From the desktop, right-click MyComputer and click properties (on Vista/Win7 click Advanced system settings onthe left side).
- In the System Properties window, click on the Advanced tab.
- In the Advanced section, click the Environment Variables button.
- Finally, in the User Variables area, you can add or edit variables.
- To add a new one click on New, the first line is the name of the variable (PATH for example), the second the value. If several values are added, they must be separated by a ;.
- To modify one, select it and click on Edit...
C:\Program Files;C:\Winnt;C:\Winnt\System32
- Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown above.
本文解决Qt5.2.0在Windows环境下使用msvc2012编译时出现的C2589和C2059错误。通过调整代码中的std::numeric_limits使用方式,成功解决编译问题。
871

被折叠的 条评论
为什么被折叠?



