Build FTLK development environment on win10 platform

    FTLK is a lightweight, cross-platform C++ GUI development library with built-in OpenGL functions, faster speed, smaller size, loose protocol, etc. The following describes how to build an FTLK development environment on the Win10 platform.
    1. Software environment
    Win10 64-bit
    FTLK version: v1.3.5
    Development tools: VS2013

    2, to FTLK official website to download version v1.3.5, to Microsoft's official website to download VS2013, or MSDN itellyou download VS2013,

    3. Install VS2013 first, check the components related to the C++ compilation environment, and next until the installation is complete;

    4. Compile FTLK v1.3.5
    4.1) Unzip the fltk-1.3.5-source.tar file, enter the fltk-1.3.5\ide\VisualC2010 directory, find fltk.sln, right-click fltk.sln and open it with VS2013; As shown in Figure 1:

Figure (1) Open fltk.sln project with VS2013

    4.2) Compile FLTK v1.3.5 into 2 versions: Debug and Relese
    a) In the VS2013 solution explorer, right-click the demo project --> Set as startup project;
    b) In the toolbar, set the compilation property to Debug And Win32;
    c) Right-click the solution fltk --> [Generate] to get the Debug version of the library file;
    d) On the toolbar, change the compilation properties to Release and Win32, press Ctrl+Shift+B shortcut key, Generate a Release version of the library file;

Figure (2) Compile the Debug version library file of FLTK v1.3.5

Figure (3) Compile the Release version library file of FLTK v1.3.5

    5. Configure FLTK v1.3.5 environment
    5.1) Copy the entire folder of fltk-1.3.5/FL to the VC/include path of VS2013, that is, copy to
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include Under the directory, as shown in Figure (4):

Figure (4) Copy the FL folder to the VC/include path of VS2013

    5.2) Copy all *.lib files in the fltk-1.3.5/lib folder to the VC/lib path of VS2013, that is, copy to the
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib directory ,
As shown in Figure (5):

Figure (5) Copy *.lib file to VC/lib directory of VS2013

    6. Test FTLK
    6.1) Restart VS2013, create a new empty console type project with the name FLTKhello, add a hello.cpp file, the code is as follows:
//hello.cpp

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

int main(int argc, char* argv[]) {
    
    
	Fl_Window *window;
	Fl_Box *box;

	window = new Fl_Window(450, 330, "First App!");
	box = new Fl_Box(20, 40, 360, 200, "Hello FLTK,你好 FLTK");
	box->box(FL_FLAT_BOX);
	box->labelsize(36); //设置字体大小
	box->labelfont(FL_BOLD+FL_ITALIC); //设置字体样式
	box->labeltype(FL_SHADOW_LABEL); //设置label类型

	window->end();
	window->show(argc, argv);

	return Fl::run();
}

    6.2) Add preprocessing WIN32 field,
    right-click the project -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definition -> Add WIN32 field, as shown in Figure (3):

Figure (5) Add WIN32 field

    6.3) Add the corresponding library files to the linker, such as Comctl32.lib and fltkd.lib (Debug version marked with d), etc.;
    right-click the project -> Configuration Properties -> Linker -> Input -> Additional Dependencies Items, as follows:

Comctl32.lib
fltkd.lib

As shown in Figure 6:

Figure (6) Add the corresponding library file in the linker

    6.4) Add a ForceUT8 plug-in in VS2013. Note that it is of no BOM type. The plug-in will force all code files to be saved in UTF-8 encoding format, which solves the headache of Chinese garbled problems in FLTK. The steps are as follows:
    Right-click [Tools] on the VS2013 menu bar --> Extensions and Updates --> Click [Online] --> Type in the search box: ForceUTF8 --> Wait about 2 minutes, the plug-in will be displayed, Click [Download], and then restart VS2013.

Figure (7) Add ForceUTF8 plug-in in VS2013 to solve the Chinese garbled problem

    6.5) Press Ctrl+Shift+B to compile the project, then press F5 to get the following:

Figure (8) FLTK test successfully!

    It means that the FLTK library file is compiled successfully, and the FTLK environment has been configured.

Guess you like

Origin blog.csdn.net/sanqima/article/details/108184789