On 07/10/12 06:37, Giuliano wrote:
> I prefere to spend a little more time now for freedom in the future..
Well put -- A-men! 8^D
Glad you've seen the light ;)
I think you'll find the recommendation for compiling your example
program using:
fltk-config --compile yourapp.cxx
..will make building programs easy for you.
If you need images or opengl in your program, just add
the correct --use-XXX flags when building your app, eg:
fltk-config --use-gl --use-images --compile yourapp.cxx
fltk-config is good to start with, as it knows all the
compiler/linker flags to use to link against FLTK.
This is because it uses the same flags to build your app
that FLTK used to build itself.
If you did a 'make install' when building fltk, then the 'fltk-config'
in your path should be correct.
If you didn't do a 'make install' on FLTK, and just did a 'make',
then be sure to supply the absolute path to your fltk-config
command when building your example.
You can look at the compiler and linker commands fltk-config
is actually running to build your app to see what's really going on,
and then you can read up on all those flags in the compiler/linker
man pages (eg. 'man g++' and 'man ld')
Later, as you start making multiple modules, you'll probably want
to move to a Makefile, but for now, running those fltk-config lines
in your shell should be OK to build simple single file apps.
You can use even those simple fltk-config commands in a Makefile;
then you can just type 'make' instead of those longish fltk-config
commands. Here's a simple 2 line Makefile for the above:
yourapp.exe: yourapp.cxx
fltk-config --compile yourapp.cxx
Note: that should be a 'tab' in front of that 'fltk-config' line.
With that, you should just be able to type 'make' and it should
rebuild your app (assuming the date stamp on your .cxx file
is more recent than your exe)
If fltk-config isn't in your path, you can supply an absolute
path to it in the Makefile, eg:
yourapp.exe: yourapp.cxx
c:/fltk-1.3.x/fltk-config --compile yourapp.cxx
If you're not familiar with Makefiles, they're kind of like
shell scripts in that they execute commands to build things,
but have an added feature in that you specify not only the
build command, but you also associate the input and output
files to the build command. This way 'make' knows to run
the build command if the output file (yourapp.exe) is more
recent than the input file (yourapp.cxx).
The reason this is useful is when you have a complex hierarchy
of interdependent files, 'make' only rebuilds the files that
are out of date.
The format of build lines in Makefiles is generally:
output: input
shell-command-to-make-output
or:
target: source
build-command
..where 'target' and 'source' are filenames, and build-command is a
shell
command that constructs the 'target' file from the 'source' file,
if and only if the 'source' has a more recent date stamp than 'target'.
Most Makefiles have a hierarchy of sources and targets all chained
together,
so if a + b are needed to make c, and c + d are needed to make e, then
the Makefile for that would be:
c: a b
command-to-make-c
e: c d
command-to-make-e
The format of Makefiles hasn't changed in decades, so it's something
you can depend on like the compilers and linkers.
Of course every few years, the compiler flags change a bit, since
there's often new features in compilers worth using. This is why
fltk-config saves you the trouble of having to track those small
changes.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk