trouble installing FLTK on xcode 8.3.3 on mac 10.12.4 using 64 bit macbook

181 views
Skip to first unread message

JY

unread,
Jun 21, 2017, 4:06:45 AM6/21/17
to fltk.general

Hi,
I am a programming beginner and am learning gui from Programming: Principles and Practice Using C++ 2nd from Bjarne Stroustrup. 

I have some problems installing fltk on the xcode. More specifically, I managed to run the demo using fltk 1.3.4. But I am not entirely sure about 4.7 in readme.osx:

"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/"

I cannot find "./(Organizer->Derived Data Path)/Release/" and I cannot find "Build for Archiving" option in xcode. 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Regardless, I proceed with the testing using sample code from the book: 
#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();
}


But it does not compile. The error message is <FL/Fl.h> is not found. I searched online and tried to add header files in FL folder in the xcode header search path. This time, xcode manage to find all three header file, but it cannot find "#include <FL/Fl_Export.H>" mentioned in <Fl.h>. So, I suppose I did not add header search path correctly. 

In addition, when I create a whole new project, I have no idea how to "include fltk environment", and I have no idea how to include all fltk libraries at a new xcode projects. 



A more senior programmer has tried to fix the problem, but failed. So, I suppose it is not  trivial. Any help is much appreciated! Thank you.

Regards
JY






Albrecht Schlosser

unread,
Jun 21, 2017, 6:55:16 AM6/21/17
to fltkg...@googlegroups.com
> <https://lh3.googleusercontent.com/-eVc4iSVbg-Y/WUnj-zSgQgI/AAAAAAAAACM/Iw_0I72WBfoSkAcd4irFAffG6MHzrFKjgCLcBGAs/s1600/1.jpeg>
>
>
> But it does not compile. The error message is <FL/Fl.h> is not found. I
> searched online and tried to add header files in FL folder in the xcode
> header search path. This time, xcode manage to find all three header
> file, but it cannot find "#include <FL/Fl_Export.H>" mentioned in
> <Fl.h>. So, I suppose I did not add header search path correctly.

First of all, I'm not sure what you did by reading your description. If
you tried to move (copy) FLTK header files to the Xcode search path:
don't do this. Don't change the #include statements either. And try to
use the correct (case sensitive) spelling from the beginning even if
your file system on MacOS is not case sensitive to be more portable to
other OS's.

Your header search path shown in the image appears to be wrong. Please
remove the trailing 'FL/' since this is taken from the '#include
<FL/...>' statement. Note that this is different from the library
include path which must include '/lib/'.

So if you used FLTK 1.3.4-1 and extracted it in /path/to/fltk-1.3.4-1/
and used the bundled Xcode project in /path/to/fltk-1.3.4-1/ide/Xcode4/
to build FLTK, then the paths in your own Xcode projects should likely be:

header search path: /path/to/fltk-1.3.4-1/
library search path: /path/to/fltk-1.3.4-1/ide/Xcode4/lib [*]

[*] I'm not sure about that one. Check where the libs (libfltk.a etc.)
reside after building FLTK. I don't know anything about MacOS
frameworks, so I might be entirely wrong.

Note again: header search path without 'FL/', library search path with
'lib/' or whatever. You must *add* these paths to whatever your Xcode
project settings already have. Refer to the README file for details.

JY

unread,
Jun 22, 2017, 7:41:12 AM6/22/17
to fltk.general, Albrech...@online.de
Hi, 

I managed to add in the header file, lib search path,  other linker flags and fltk frameworks. Now xcode can find all header file, but it could not compile. The details are below: 

Any idea what went wrong? 

Reply all
Reply to author
Forward
0 new messages