c++ - 设置 Xcode 和 FLTK

标签 c++ xcode fltk

尝试构建 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 and Library Search Paths, as well as referencing the fltk library(/ies) in the Linked Frameworks and Libraries

对我不起作用,或者我弄错了特定的文件路径。我已经尝试过 Xcode 5.1.1 和 6.0,两者都有同样的问题。

我附上了我的build设置的屏幕截图。 Build Settings on Xcode

最佳答案

我在 groups.google.com 找到了解决方案以下是我所做的:

  1. 这样更改build设置:

    header 搜索路径:-I/usr/local/include

    库搜索路径:/usr/local/lib

Search Paths

  1. 转到终端并输入 fltk-config --ldflags

    你得到一排旗帜,我的是 -L/usr/local/Cellar/fltk/1.3.2_1/lib -lfltk -lpthread -framework Cocoa.

    在 Xcode build设置中,将其粘贴到 other linker flags

enter image description here

  1. 完成这些步骤后,Xcode 成功编译了文件。

关于c++ - 设置 Xcode 和 FLTK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25879961/

相关文章:

c++ - Canny 边缘检测 - 灰度图像总是以 3 channel 出现,无法使用?

iphone - 如何从 iPhone 中的某一天获取日期?

iphone - 在 Xcode 4.2 中以编程方式编写 iPhone 应用程序的 UITableView

c++ - 如何让自定义小部件接受像 textctrl 这样的键盘事件

c++ - 迭代两种可能类型的可迭代对象 C++

ios - 如何更改所有 Storyboard中所有 UILabel 的 textAlignment

c++ - 在 FLTK 中使用 GLUT

c++ - 在 OpenGL 中播放动画

c++ - FLTK 不适用于 Stroustrup header

c++ - 预分配 unordered_map 的线程安全