Help with FLTK, which is used in the Stroustrup book. I downloaded FLTK, compiled it with make install. When I try to compile

#include <FL/Fl.H> #include <FL/Fl_Box.H> #include <FL/Fl_Window.H> int main() { Fl_Window window(200, 200, "Window title"); Fl_Box box(0,0,200,200,"Hey, I mean, Hello, World!"); window.show(); return Fl::run(); } 

Gives an error message

 FL/Fl.H: No such file or directory #include <FL/Fl.H> 

I tried both through VSCode and through the usual command line (I understand that there are detailed installation guides in Visual Studio, but this is somewhat limited in understanding what is happening in general). In VSCode added the path "C: / FLTK / include". Removed "fl /" in the headers. Added an environment variable. The same mistake. What is the problem? (Win10)

Answer In general, I found a solution using fltk-config --compile xxx.cpp and MSYS. When running from under msys, you can get a command that looks like this

 g++ -IC:/FLTK/include -IC/FLTK/include/FL/images -mwindows -DWIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o "name" "name.cpp" -mwindows C:/FLTK/lib/libfltk.a -lole32 -luuid -lcomctl32 

Shorter version also works.

 g++ -IC:/FLTK/include -IC/FLTK/include/FL/images -mwindows -o "name" "name.cpp" "name2.cpp"... C:/FLTK/lib/libfltk.a (и далее библиотеки прописываются так же полным путем) -lole32 -luuid -lcomctl32 

Now it can be used from under the usual win-console without fltk-config, which does not work in cmd (as well as in the integrated VSCode terminal), in MSYS it only works if the library installs the default installation path (in my case, msys / local / lib ) otherwise it is necessary to prescribe the full path (flexibility suffers).

  • one
    You should familiarize yourself with the work of the preprocessor, specifically with the include directive (do not read the elapsed books before dinner). Then look into the documentation for your compiler, and see what compiler options are responsible for the preprocessor, and specifically for the include directive. - VTT
  • @VTT, I identified a specific problem that arises in me with one particular library. - Alexey

0