尝试构建 first block of code on this page 时遇到的错误在 Xcode 下
Undefined symbols for architecture x86_64:
"fl_define_FL_SHADOW_LABEL()", referenced from:
_main in main.o
我通过 brew install FLTK
用自制软件安装了 FLTK,没有错误:
/usr/local/Cellar/fltk/1.3.2_1: 315 个文件,5.8M,在 93 秒内构建
我意识到这个问题已经asked before , 但答案
You need to install it first as it's not on Mac OS X, using something like homebrew/macports/manually which will provide you with an installed copy that can be referenced using the
User Header Search Paths
andLibrary Search Paths
, as well as referencing the fltk library(/ies) in theLinked Frameworks and Libraries
对我不起作用,或者我弄错了特定的文件路径。我已经尝试过 Xcode 5.1.1 和 6.0,两者都有同样的问题。
我附上了我的build设置的屏幕截图。
最佳答案
我在 groups.google.com 找到了解决方案以下是我所做的:
这样更改build设置:
header 搜索路径:
-I/usr/local/include
库搜索路径:
/usr/local/lib
转到终端并输入
fltk-config --ldflags
你得到一排旗帜,我的是
-L/usr/local/Cellar/fltk/1.3.2_1/lib -lfltk -lpthread -framework Cocoa
.在 Xcode build设置中,将其粘贴到
other linker flags
- 完成这些步骤后,Xcode 成功编译了文件。
关于c++ - 设置 Xcode 和 FLTK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25879961/