質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

C++

C++はC言語をもとにしてつくられた最もよく使われるマルチパラダイムプログラミング言語の1つです。オブジェクト指向、ジェネリック、命令型など広く対応しており、多目的に使用されています。

Q&A

解決済

1回答

2489閲覧

xcode8.2.1でFLTKを使いたいです

rush1447

総合スコア7

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

C++

C++はC言語をもとにしてつくられた最もよく使われるマルチパラダイムプログラミング言語の1つです。オブジェクト指向、ジェネリック、命令型など広く対応しており、多目的に使用されています。

0グッド

0クリップ

投稿2017/04/01 11:15

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.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

一様できました。
1)FLTKをダウンロードする
2)ダウンロードファイルを解凍して、その中に入っているideファルダーを開く
3)ideフォルダーの中にXcodeのファイルがあるので(この時はXcode4のファイルが入ってました。)、
そのXcodeのファイルの中にあるFLTKプロジェクトをXcodeで開く
4)メニューバーのProduct > SchemeでターゲットをDemoにしておく
5)メニューバーのProduct > Build for > Runningを実行し、またメニューバーのProduct > Runを実行し、Xcodeを終了する
6)Finderのサイドバーに家のマークがついているタブ(なければ、Finderの環境設定のサイドバーから表示させるように設定する) > Library(なければメニューバーのView > Show View Optionsから表示させるように設定する) > Xcode > DerivedData > 名前がFLTKから始まるファイル > Build > Intermediates > ArchieveIntermediates > Demo > Frameworks内の.frameworkで終わっているものを全てcopyする。copyはFinderのサイドバーからMacintosh HD(なければFinderの環境設定から表示させるように設定する) > Library > Frameworksにしておく
7)FLTKのライブラリーを使いたいプロジェクトをXcodeで開く
8)Xcodeの左サイドバーのプロジェクト名 > General > Linked Frameworks and Librariesで+マークをおす
9)左下にあるAdd Otherから6)で保存したfltk.frameworkたちを加える
10)8)のGeneralまで戻り、Build Settings > Search Paths > Header Search PathsのDebug、Releaseの両方に6)で保存したfltk.framework > Versions > A > Headerのパスを加える(パスの加え方はdrug and dropでもOK)

この手順でできました。
もしリンクエラーでabi-version.hが見つからないよって言われたら、2)で展開したfltkファイル > FL > abi-version.hを10)の Header(fltk.framework > Version > A > HeaderのHeader)に保存するとできるかもです。

投稿2017/04/01 23:57

rush1447

総合スコア7

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問