• 6458阅读
  • 1回复

[提问]Qt库qdatetime.h中报错“min”宏的实参不足 [复制链接]

上一主题 下一主题
离线zhutou7
 
只看楼主 倒序阅读 楼主  发表于: 2013-07-19
这行:static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }
1>e:\qt\5.1.0\msvc2012\include\qtcore\qdatetime.h(121): warning C4003: “min”宏的实参不足1>e:\qt\5.1.0\msvc2012\include\qtcore\qdatetime.h(121): error C2589: “(”:“::”右边的非法标记
1>e:\qt\5.1.0\msvc2012\include\qtcore\qdatetime.h(121): error C2059: 语法错误:“::”


在main.cpp里引用了<QTime>,也在stdfax.h中引用了ATL, 是两套宏定义冲突了还是? 如果不include ATL的话编译通过
[font='Lucida Console']  [font='Lucida Console']2[font='Lucida Console']    [font='Lucida Console']#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // some CString constructors will be explicit
  3    #include <atlbase.h>
  4    #include <atlstr.h>


但如果没有ATL, 在DEFINE_COM_GUID(IID_ComBase, ....)中,编译器就没法识别name了吧?
[font='Lucida Console']  [font='Lucida Console']1[font='Lucida Console']    [font='Lucida Console']#define DEFINE_COM_GUID(name, w1, l1, l2, b1, b2, b3, b4, b5, b6, b7, b8) \
  2    extern "C" const GUID __declspec(selectany) name = { \
  3     w1, l1, l2, {b1, b2, b3, b4, b5, b6, b7, b8} }
  4        
  5        DEFINE_COM_GUID(IID_ComBase,
  6        0x7fe76cc2, 0x3d06, 0x4376, 0xbb, 0x30, 0xee, 0x44, 0xf, 0x4a, 0x6a, 0xc9);
没有ATL的情况下,在DEFINE_COM_GUID那行报了这样的错
1>E:\include\ComBase.h(19): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>E:\include\ComBase.h(19): error C2144: 语法错误:“int”的前面应有“;”


----------------------------------------------------------------------------------------------------------------------------------------
我把QTime改成CTime就能跑出对话框了 但不理解为什么QTime不可以 不了解ATL
先谢谢大家了!
离线raidsan

只看该作者 1楼 发表于: 2013-09-01
所有引用 windows.h的地方:  #include <windows.h>
换成 #include <qt_windows.h>
里面已经有qt对windows.h的适应化修改
快速回复
限100 字节
 
上一个 下一个