gpt4 book ai didi

c++ - linux下使用mingw交叉编译器声明 'parameters'中的两种或多种数据类型

转载 作者:太空宇宙 更新时间:2023-11-04 11:57:51 25 4
gpt4 key购买 nike

我正在尝试使用 MinGw 为 Windows 交叉编译一些代码。代码相当简单:

标题:

    class DragLabel : public QLabel
{

Q_OBJECT

public:
DragLabel();
void fn(QString path, int id, bool small);
};

CPP: #include "draglabel.h"

    DragLabel::DragLabel()
{
/* Snip ... */
};

void DragLabel::fn(QString path, int id, bool small)
{
(void)d;
};

示例函数无法编译给我:

error: two or more data types in declaration of 'parameter'

对于fn(QString...)的声明。[编辑:] 对不起,我忘了提到这个错误只有在声明了 bool 变量时才会发生,所以函数没有:

void fn(QString path, int id);

工作得很好。

它在 debian linux 下使用 qmake 和 make 编译得很好。

有谁知道这里会发生什么?谢谢

最佳答案

似乎 small 是 MinGW 的一些扩展关键字(我在标准中找不到它)。根据

When i change everything to int it works

small 是一些限定符,例如 longsigned,它扩展了 int 声明。

尝试将变量名从 small 更改为其他名称。

关于c++ - linux下使用mingw交叉编译器声明 'parameters'中的两种或多种数据类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15406119/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com