Last successfully tested: 30.11.2017
As it was quiet frustrating getting everything to run, I thought I would take the extra time to make it extra detailed, I hope it is not confusing or over complicating things for who ever is struggling with this.
Step 1: Downloading fltk-1.3.4.
Go to: http://www.fltk.org/index.php
Go to the download tab and click on fltk-1.3.4-1-source.tar.gz
The fltk-1.3.4-1-source.tar.gz should be automatically downloaded.
I used winRar to extract fltk-1.3.4-1-source.tar.gz to my documents folder.
Step 2: Compiling and building fltk-1.3.4 from source.
Open (double-click) fltk.sln.
Visual Studio 2017 Community will open, and ask you if you want to update the files.
Click OK and wait for a few moments.
Your window will look like this:
Right-click the demo solution file.
Click on Set as StartUp Project.
Now click on Build and Build Solution.
After a couple of moments your Output window shows Build: 79 succeeded…
Make sure to set Debug mode.
Press F5 on your keyboard. Or the playbutton on top of your canvas Local Windows Debugger.
Now change the Debug mode to Release mode on the top left corner of your Visual Studio window.
You should now see the fltk-test layout and no console window.
Good job. Done compiling and test-running.
Now you need to copy those freshly compiled files (explained in three steps in the next paragraph) into your Visual Studio 2017 Community folder structure so it knows where to find them:
fltk-1.3.4-1\lib to VC\Tools\MSVC\14.10.25017\lib\x64
fltk-1.3.4-1\lib to VC\Tools\MSVC\14.10.25017\lib\x86
Let’s open Visual Studio 2017 Community (or any other of course) and under the Visual C++ – Windows Desktop tab create a new Windows Desktop Wizard project.
Tick the box Empty project (very important).
I called it fltk_test.
I called it fltk_test.cpp.
Copy the following code into your .cpp file:
Then go to your top navigation bar and click Project and in the drop-down menu Properties.
Make sure to set the Configuration to Debug.
On your left hand side go to Linker.
Click on the drop-down arrow in the Additional Dependencies tab.
And click on Edit.
A new window will pop up. In the screenshot shown I filled in already the following entries:
Please do the same.
Click OK to confirm your entry.
And set the SubSystem to Console (/SUBSYSTEM:CONSOLE) with the help of the drop-down menu.
If you have done everything I told you so far your project should compile and run and show something like this:
And chose from the Configuration Release.
On the left hand side to Linker and then to Input, just like you did before.
Click on the drop-down arrow to show the Additional Dependencies menu and select Edit.
Click OK and go to Sysyem.
Now change the Solution Configurations to Release.
If everything went well you should be able to look at something like this (application window with the fltk-interface and no console window, if this didn’t go as planned please go to the next step):
(If everything works for you just fine, please skip ahead!)
# include “Enumerations.H”
# define WIN32
# ifdef WIN32
For who ever was interested in just getting the fltk-1.3.4 GUI library running and applying it on a test project, this is the end of your journey and this guide. If you are working through Bjarne Stroustrup’s Programming Principles and Practice Using C++ and you are in Chapter 12 starting to use fltk keep on reading for instructions on how to use it within the “Stroustrup”-environment:
Safe your fltk test-project and create a new project. Under the Visual C++ – Windows Desktop tab create a new Windows Desktop Wizard project, just like you did before (I will go through this a bit faster as you should be familiar by now).
Tick the box Empty project (very important).
I called mine BS_PPP_Cpp_fltk.
Let’s begin with the header files:
Most of the people reading, working through Programming Principles and Practice Using C++ included the std_lib_facilities.h already many times so for who ever does not know where to get it from, this is the link. Download it and copy it in your project folder (in my case: C:\Users\Philipp\Documents\Visual Studio 2017\Projects\BS_PPP Cpp_fltk\BS_PPP_Cpp_fltk\BS_PPP_Cpp_fltk).
As well as the following header files:
Right-click the Header Files folder in your project’s solution explorer. Add an Existing Item.
Once you added all your header files the Header Files folder should look like this:
Now you are almost there. We just have to make a couple of changes to those Added files.
Open the Point.h header file by double clicking it:
Remove all the notation double forward-slashes:
Open the GUI.cpp file by double clicking it:
Add Graph_lib:: in front of Window& of Button::attach (line 8)
In_box::attach (line 30) and Out_box::attach (line 49).
and remove or notate the constructor Menu::Menu as it is already defined in GUI.h.
Open the Graph.cpp file:
And go to line 313. Change return ff; to return bool(ff);
The last change you have to make is in Graph.h, open and #include “std_lib_facilities.h”:
If everything goes right and you were able to follow my instructions you should be able to see the following:
If you made it so far and everything worked out I am very happy I could help you. At this point I should mention Benjamin Wuethrich. I followed his tutorial on installing and using fltk on Visual Studio 2015 and with the help of a bunch of other peoples forum posts and other informations I was able to transfer the knowledge to make it happen on Visual Studio 2017 Community. So thanks to Benjamin Wuethrich. His tutorial for Visual Studio 2015 can be found here.