xcodeでFLTKのライブラリを使いたいと思っています
xcodeにFLTKをインストールする方法を知りたいと思ってます。
下にあるREADME.OSX.txtの4.4以降のやり方などがわかれば
できると思うのですが、どうでしょうか
###発生している問題・エラーメッセージ
Undefined symbols for architecture x86_64:
"Fl::run()", referenced from:
_main in main.o
"Fl_Box::Fl_Box(int, int, int, int, char const*)", referenced from:
_main in main.o
"Fl_Widget::~Fl_Widget()", referenced from:
Fl_Box::~Fl_Box() in main.o
"Fl_Window::show()", referenced from:
_main in main.o
"Fl_Window::Fl_Window(int, int, char const*)", referenced from:
_main in main.o
"Fl_Window::~Fl_Window()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
###該当のソースコード
C++
#include <FL/Fl.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Window.H>
int main()
{
Fl_Window window(200, 200, "Window title");
Fl_Box box(0, 0, 200, 200, "Hey, I mean, Hello, World!");
window.show();
return Fl::run();
}
###試したこと
インストールしたfltk-1.3.4-1の中に入っていた
README.OSX.txtの手順の4.3までを行なっって
何をすれば良いか分からず、4.4以降は行なっていないです。
###補足情報(言語/FW/ツール等のバージョンなど)
以下、「試したこと」で述べたREADME.OSX.txtです。
README.OSX.txt - 2016-04-01 - Building FLTK under Apple OS X
4 HOW TO BUILD FLTK USING XCODE4
4.1 Prerequisites
In order to build FLTK from within Xcode 4, 5, 6, 7, or 8 you need to install
the Xcode developer environment via the Apple App Store that comes with
Lion and up. If you also want the command line version of gcc, you can use
the Download section in the Preferences dialog.
4.2 Downloading and Unpacking
Download FLTK from here:
http://www.fltk.org/software.php
If you are familiar with "subversion" and like to stay current with your
version, you will find the subversion access parameters at the bottom of that
page. You can use the SCM system that is built into Xcode.
Unpack FLTK by double-clicking it and copy the new folder into a convenient
location. I have set up a "dev" folder in my home folder for all my projects.
4.3 Configuring FLTK
Launch Xcode. Open the project file in
.../fltk-1.3.xxxx/ide/Xcode4/FLTK.xcodeproj
There is nothing else to configure.
4.4 Building FLTK
Use the "Scheme" pulldown menu to change the active target to "Demo" and
"My Mac 32-bit" or "My Mac 64-bit". Select "Build for" -> "Running"Run" from
the "Product" menu to create all libraries and test applications.
By default, the Xcode4 project builds applications that run under Mac OS X 10.5
and above. To build applications that also run under older Mac OS versions,
modify the "OS X Deployment Target" item of the FLTK project build settings.
All frameworks and apps will be located in a private directory. Use
"Window"->"Organizer" to find the full path.
4.5 Testing FLTK
Select "Run" from the "Product" menu to run the Demo program. Use "Demo"
to explore all test programs.
4.6 Uninstalling previous versions of FLTK
Remove FLTK frameworks:
sudo rm -r /Library/Frameworks/fltk*.framework
Remove Fluid and possibly other utilities:
sudo rm -r /Applications/FLTK/
4.7 Installing FLTK
When distributing FLTK applications, the FLTK frameworks should be made part of
the application package. For development however, it is very convenient to have
the Release-mode Frameworks in a standard location.
For Xcode project template use, all FLTK frameworks should be built using
"Build for Archiving" and then copied from
"./(Organizer->Derived Data Path)/Release/" to "/Library/Frameworks/".
The FLTK header files for all FLTK frameworks will then be at
"/Library/Frameworks/fltk.framework/Headers/". Add this path to the header
search path of your projects.
sudo rm -f -r /Library/Frameworks/fltk*
sudo cp -R (Organizer->Derived Data Path)/Release/fltk*.framework /Library/Frameworks/
Many FLTK applications will use Fluid, the FLTK User Interface builder, to
generate C++ source code from .fl resource files. Add Fluid to the developer
tools:
sudo mkdir /Applications/FLTK/
sudo rm -f -r /Applications/FLTK/Fluid.app
sudo cp -R (Organizer->Derived Data Path)/Release/Fluid.app /Applications/FLTK/
(TODO: 4.8 Installing Little Helpers) (TODO: 4.9 Creating new Projects)
5 MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES ON ITS ICON
- Prepare an Info.plist file for your application derived from file
ide/Xcode4/plists/editor-Info.plist which allows any file to be dropped
on the application icon.
You can edit this file in Xcode and change
Document types/Item 0/CFBundleTypeExtensions/Item 0
from the current "*" to the desired file extension. Use several items to
declare several extensions.
- Call fl_open_callback() at the beginning of your main() function that sets
what function will be called when a file is dropped on the application icon.
- In Xcode, set the "Info.plist File" build setting of your target application
to the Info.plist file you have prepared.
- Rebuild your application.
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。