尝试在Mac上编译我的QT应用程序时出错。 我跟着这个tutorial,所有代码都在页面底部。
当我构建项目时,我得到以下内容:
Undefined symbols for architecture x86_64:
"DiagramItem::addArrow(Arrow*)", referenced from:
DiagramScene::mouseReleaseEvent(QGraphicsSceneMouseEvent*) in diagramscene.o
"DiagramScene::setItemType(DiagramItem::DiagramType)", referenced from:
MainWindow::buttonGroupClicked(int) in mainwindow.o
DiagramScene::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) in moc_diagramscene.o
"DiagramScene::setTextColor(QColor const&)", referenced from:
MainWindow::textButtonTriggered() in mainwindow.o
"DiagramScene::setMode(DiagramScene::Mode)", referenced from:
MainWindow::buttonGroupClicked(int) in mainwindow.o
MainWindow::pointerGroupClicked(int) in mainwindow.o
MainWindow::itemInserted(DiagramItem*) in mainwindow.o
MainWindow::textInserted(QGraphicsTextItem&) in mainwindow.o
DiagramScene::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) in moc_diagramscene.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [DiagramScene.app/Contents/MacOS/DiagramScene] Error 1
18:41:52: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project DiagramScene (kit: Desktop)
When executing step 'Make'
之前有人见过这个或有任何建议吗?
提前致谢。 :)
答案 0 :(得分:2)
链接器正在告诉你究竟发生了什么。没有为列出的方法提供实现,即:
只需编写这些方法的实现即可。如果您从帮助页面复制粘贴代码,则示例可能不完整。