-1

I'm a complete beginner to programming, so I'm sorry if I get anything wrong in this question (please let me know if I do!). I'm reading Programming: Principles and Practice using C++ by Bjarne Stroustrup, and I've hit a roadblock at Ch12.

After a lot of attempts, I can't figure out how to set up FLTK so that I can include its header files in a cpp source file to use the interface. What I want is to have all of the FLTK header files to act exactly like the standard library header files - their source code is precompiled as object code, and implicitly linked when I run "c++ -std=c++17 [file-name].cpp" in the terminal, and then I can run ./a.out to run the executable program. Is this how FLTK can be used, and if so, is there a simple way of setting this up?

I'm not using any IDE because I want to familiarize myself with how everything works, and from my understanding IDEs hide some compilation details.

I ultimately want to be able to run this program:

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>

int main() {
    Fl_Window window(200, 200, "Window title");
    Fl_Box box(0,0,200,200, "erwrew");
    window.show();
    return Fl::run();
}

Also, as an unrelated question, do you have any beginner tutorial recommendations for setting up makefiles?

Ðаn
  • 10,934
  • 11
  • 59
  • 95
Keeyan
  • 99
  • 1
  • 7

1 Answers1

1

Before trying to compile the progam using the FLTK library, I kindly suggest that you have a look at how to write a Makefile: this contains a fully explanation, while if you want a shorter introduction you can have a look here and/or here.

Regarding FLTK: at this link you can find the instructions to write a Makefile that set up the options to compile a program with FLTK libraries. There are some flags that automatically set up the options for the FLTK library.

Eddymage
  • 1,008
  • 1
  • 7
  • 22