praveen wrote:
>>      For more info on compile/link flags see 'fltk-config -help',
>>      and the link Duncan mentioned:
>>      http://www.fltk.org/doc-1.1/basics.html#basics

> I am not compiling single program as to compile with fltk-config --use-gl 
> --compile test.cpp

        I think you're missing this part:

--- snip
The fltk-config script included with FLTK can be used to get the options that 
are required by your compiler:

      CC `fltk-config --cxxflags` ...
--- snip

        ..etc, which you can use to derive the macros needed to link several 
.o's.
        Basically in this case, fltk-config just prints the flags on stdout, 
which
        your Makefile or script can bring into variables and use, as shown 
below.

> I'm using a makefile to compile which is below :

        Here's a modified version of your Makefile which works for me,
        where I've copied the fltk CubeView* files into a separate directory,
        and used this makefile to compile them.

        I added a 'make clean' target, and added a .SUFFIXES to get .o -> .cxx
        to work.

        I had to remove an #include <config.h> from one of the fltk src files,
        as that's not really needed for builds outside of the fltk directory.

        If you try to paste the below, be sure to preserve the tab indents
        for the build commands; some make(1) programs care about tabs vs. 
spaces.

        I don't know anything about icc, but I assume if FLTK was built with it,
        then fltk-config will return the correct info.

        Core folks: I guess this example could maybe be added to the above docs
        as an example of how to build a multi-module executable.

-- snip

CC       = $(shell fltk-config --cc)
CXX      = $(shell fltk-config --cxx)
DEBUG    = -g
CFLAGS   = $(shell fltk-config --use-gl --use-images --cflags ) -I.
CXXFLAGS = $(shell fltk-config --use-gl --use-images --cxxflags ) -I.
LDFLAGS  = $(shell fltk-config --use-gl --use-images --ldflags )
LDSTATIC = $(shell fltk-config --use-gl --use-images --ldstaticflags )
LINK     = $(CXX)

TARGET = cube
OBJS = CubeMain.o CubeView.o CubeViewUI.o
SRCS = CubeMain.cxx CubeView.cxx CubeViewUI.cxx

.SUFFIXES: .o .cxx
%.o: %.cxx
        $(CXX) $(CXXFLAGS) $(DEBUG) -c $<

all: $(TARGET)
        $(LINK) -o $(TARGET) $(OBJS) $(LDSTATIC)

$(TARGET): $(OBJS)
CubeMain.o: CubeMain.cxx CubeViewUI.h
CubeView.o: CubeView.cxx CubeView.h CubeViewUI.h
CubeViewUI.o: CubeViewUI.cxx CubeView.h

clean: $(TARGET) $(OBJS)
        rm -f *.o 2> /dev/null
        rm -f $(TARGET) 2> /dev/null

-- snip
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to