Mac上的Qt显示符号未在架构x86_64中找到

Qt on Mac saying symbol(s) not found for architecture x86_64

本文关键字:x86 Qt 上的 显示 符号 Mac      更新时间:2023-10-16

嗨,我使用Qt在macOS上创建扫雷游戏,每当我为我的类编写一些信号和插槽时,我的应用程序就不会编译。Qt表示ld: symbol(s) not found for architecture x86_64下面是我的代码:

enum Status {
    virgin,
    flagged,
    questioned,
    revealed
};
class Cell : public QLabel
{
    Q_OBJECT
public:
    int atRow;
    int atCol;
    int content;//0 - 8 means the numbers of mines around the cell. -1 means it's a mine itself.
    bool isMine;
    Status status;
    Cell(int atRow, int atCol);
    Cell *NorthWest,
    *North,
    *NorthEast,
    *East,
    *SouthEast,
    *South,
    *SouthWest,
    *West;

public slots:
    void mousePressEvent(QMouseEvent *event);
};

我见过很多类似的问题,但我没能解决这个问题。我试着添加CONFIG -= x86_64,但它仍然不起作用。我知道这是MOC但我不知道怎么解它。谁来帮帮我!

我碰巧终于找到了这个页面的解决方案:Qt Creator:架构x86_64的未定义符号我试过了,成功了。但我不确定这是完全正确的,所以有不同意见的人请在这里发表答案。