FLTK and OpenGL projects settings error on Xcode

36 views
Skip to first unread message

Roger

unread,
Mar 14, 2015, 11:02:52 PM3/14/15
to fltkg...@googlegroups.com
Hello fellow FLTK fans.

I work on Mac OS 10.8, and I installed my FLTK with brew and set up an Xcode project by following the steps here. To be more specific what I did is the following setting on the project:
Header Search Paths : -I/usr/local/include
Library Search Paths : /usr/local/lib
other linker flags: -L/usr/local/lib -lfltk -lpthread -framework Cocoa

After the above setup, I can compile helloworld.cpp (it draws a fltk box on an fltk window) in attachments without a hitch. But I am unable to compile another source file glwin.cpp (it draw a yellow square on an OpenGL window) that uses the Fl_Gl_window header. The error message is copied into error.txt. Some googling of the error leads me here. So I found out that I could compile correctly with the terminal by the following command
fltk-config --use-gl --compile glwin.cpp
And the option "--use-gl" did all the trick. If without it can only compile helloworld.cpp

I am curiously wondering, how do I apply an equivalent of this "use-gl" option to the Xcode project so that it compiles right?

Any comments appreciated.

Roger



glwin.cpp
helloworld.cpp
error.txt

Kevin Ingwersen (Ingwie Phoenix)

unread,
Mar 14, 2015, 11:13:02 PM3/14/15
to fltkg...@googlegroups.com
Hey.

Add the OpenGL framework and -lfltk_gl and you are good to go, if brew installs that. :)

Kind regards, Ingwie.
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<glwin.cpp><helloworld.cpp><error.txt>

Greg Ercolano

unread,
Mar 15, 2015, 1:02:29 AM3/15/15
to fltkg...@googlegroups.com
On 03/14/15 14:36, Roger wrote:
> how do I apply an equivalent of this "use-gl" option to the Xcode project
> so that it compiles right?

    Look at the build output from the fltk-config command, it should be showing you what libs + frameworks it links in, so just use those.
    For instance, building the glpuzzle test program:


$ cd /usr/local/src/fltk-1.3.x-svn/test
$ ../fltk-config --use-gl --compile glpuzzle.cxx
g++ -I.. -I../png -I../jpeg -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT -o 'glpuzzle' 'glpuzzle.cxx' ../lib/libfltk_gl.a -framework AGL -framework OpenGL -framework ApplicationServices ../lib/libfltk.a -lpthread -framework Cocoa
Creating 'glpuzzle.app' bundle for desktop...


    The text in red being the libs + frameworks to link with.

    Also, while I don't use Xcode myself (the GUI IDE anyway), pretty sure we have Xcode projects in the fltk ide/Xcode4 directory that builds FLTK, and if it includes building the opengl test programs (e.g. glpuzzle), you can look there for how to do it.
Reply all
Reply to author
Forward
0 new messages