相关疑难解决方法(0)

<algorithm>是否定义了宏X?

我尝试使用选项C++ 14 编译代码:

#define X static_cast<double>(2)
#include <algorithm>
// if you change the two lines, no error occurs

int main()
{
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

但是我在X之后得到错误:

错误:预期','或'...'

我没有选择C++ 98的错误.使用我的gcc版本4.8.4,我没有得到错误,但我用5.4.0.这是一个错误吗?我做错了吗?

c++ algorithm gcc stl

7
推荐指数
1
解决办法
195
查看次数

添加一个包含保护会破坏构建

我将#ifndef ..#define ..#endif添加到我项目的文件中,编译器失败了.一旦我删除它或在定义中添加任何其他名称它编译好.可能是什么问题呢?

听起来像文件已经声明,但我不知道在哪里.我很好,只是删除它,但我真的想知道为什么会发生这种情况.

error: expected class-name before ‘{’ token
error: ‘QDesignerFormEditorInterface’ has not been declared
Run Code Online (Sandbox Code Playgroud)

还有其他一些错误.

我实际上是在使用Qt的一个例子,"Custom Widget Plugin Example".

不同之处在于我使用自己的类作为自定义小部件(.h,.cpp和.ui文件).

它可能与包含2的文件有关,尽管这就是示例的实现方式.

c++ macros compiler-errors header include-guards

3
推荐指数
1
解决办法
3714
查看次数

标签 统计

c++ ×2

algorithm ×1

compiler-errors ×1

gcc ×1

header ×1

include-guards ×1

macros ×1

stl ×1