Compile FLTK with g++

后端 未结 1 1995
一生所求
一生所求 2021-02-04 14:45

I am working through Stroustrup\'s Principles and Practices using C++. I am trying to get the following program to compile.

#include 
#include <         


        
相关标签:
1条回答
  • 2021-02-04 15:11

    You have to link it with the libraries:

    g++ -std=c++11 trial.cpp -lfltk -o trial
    

    For your code this library is enough, but depending on what classes you use you might need to add: -lfltk_forms -lfltk_gl -lfltk_images also.

    You can also use fltk-config as mentioned here:

    g++ -std=c++11 `fltk-config --cxxflags` trial.cpp  `fltk-config --ldflags` -o trial
    

    Note: it is important to have the linking parameters (-l) after your code files (cpp and includes), otherwise you get compile errors.

    0 讨论(0)
提交回复
热议问题