0

I am trying to compile a FLTK project from linux, using the output of the commands:

fltk-config --use-gl --use-images --ldflags

And:

fltk-config --use-gl --use-images --cxxflags

I am using this makefile to compile the project:

enter image description here

I installed the latest FLTK version by just downloading it from fltk.org, and then I compiled and installed it. I also installed X11 and OpenGL. But I still get these errors:

enter image description here

I checked the file system and these headers are in /usr/local/include/FL even if they are not recognized, although I included the directory (-I/usr/local/include) and then in the .cpp and .h files:

#include <FL/Fl_PNG_Image.H>
#include <FL/Fl_Box.H>
etc...

What could be the problem? do I need to install more libraries?

EDIT

I tried to change the makefile:

CXXFLAGS=-I/usr/local/include -I/usr/local/include/FL/images -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT -I/home/ramy/boost_1_63_0 -std=c++11

LDFLAGS=-L/usr/local/lib -lfltk_images -lfltk_png -lz -lfltk_jpeg -lfltk_gl -lGLU -lGL -lfltk -lXrender -lXcursor -lXfixes -lXext -lXinerama -lpthread -ldl -lm -lX11 -L/home/ramy/boost_1_63_0/lib

SOURCES=Car.cpp Map.cpp CarState.cpp Utilities.cpp CarCollection.cpp TableView.cpp MapView.cpp
OBJECTS=Car.o Map.o CarState.o Utilities.o CarCollection.o TableView.o MapView.o

make:
    g++ $(LDFLAGS) $(CXXFLAGS) -c $(SOURCES)
    g++ $(LDFLAGS) $(CXXFLAGS) -o ../Evolution table-example.cpp $(OBJECTS)
clean:
    rm -f $(OBJECTS) ../Evolution

But I still get the same errors.

Ramy Al Zuhouri
  • 21,580
  • 26
  • 105
  • 187
  • I think you're definitely missing some of the -l flags. – Alexander Lapenkov Mar 31 '17 at 15:15
  • @AlexanderLapenkov fltk-config should be give the right output. Could it be that I need to install more libraries other than FLTK and OpenGL? if I check in /usr/local/lib there are libfltk, libfltk_png, etc... but there are not libxext, libxcursor and many others. – Ramy Al Zuhouri Mar 31 '17 at 15:18
  • Your errors are not compiler errors reporting missing headers. They are linker errors reporting failures to find definitions for symbols that are referenced in the linkage. They are caused because you are linking all your libraries before all of the object files that refer to them. – Mike Kinghan Apr 01 '17 at 08:23
  • @MikeKinghan I tried to compile the target in two steps (first objects, then the source containing the main), as you can see in my edit. But I still get the same errors. – Ramy Al Zuhouri Apr 01 '17 at 14:04

1 Answers1

0

Those errors don't mean that you are lacking headers, but libraries.

Here you can read the basis (go down to "Compiling Programs with Standard Compilers"). Basically add -L/usr/local/lib -lfltk -lXext -lX11 -lm to your app compiler command; or use fltk-config --cxxflags.

Ripi2
  • 7,031
  • 1
  • 17
  • 33