FLTK (Fast Light Tool Kit 发音为fulltick) 是一种使用C++开发的GUI工具包,它可以应用于Unix,Linux,MS-Windows95/98/NT/2000和MacOS操作系统平台,相 对于其它的许多图形接口开发工具包(如MFC、GTK、QT等),它具有体积很小、速度比较快,且有着更好的移植性。
从FLTK官网下载最新版本的源码(e.g. fltk-1.3.4-1-source.tar.gz)。解压源码文件到相应的目录,
C:\Users\yourname\Downloads\fltk-1.3.4
下面介绍如果再Visual Studio中Build Solution
找到工程文件夹。fltk-1.3.4\ide\VisualC2010双击fltk.sln,耐心等待visual studio打开。Build菜单中找到 Configuration Manager并打开,切换到Release。Build菜单中找到 Rebuild Solution并点击,耐心等待Build完成。Build成功之后我们需要做的就是把文件拷贝到相应的目录内。
复制 FL and GL 文件夹, 例如,C:\Users\yourname\Downloads\fltk-1.3.4\FLC:\Users\yourname\Downloads\fltk-1.3.4\GL 到Visual Studio的$(VC_IncludePath)文件夹下C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include复制lib文件夹下的所有文件,C:\Users\yourname\Downloads\fltk-1.3.4\lib 到Visual Studio的$(VC_LibraryPath_x86) 文件夹下C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\lib\x86重新打开Visual Studio 新建一个win32 project,在project wizard中选择Empty。 好了,现在我们新建一个main.cpp
#include <Windows.h> // include Windows.h only if using WinMain #include <FL/Fl.H> #include <FL/Fl_Box.H> #include <FL/Fl_Window.H> // Use standard main to have console background: // int main() // Use WinMain if you don't want the console in the background: int __stdcall WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in LPSTR lpCmdLine, __in int nShowCmd ) { Fl_Window window( 200, 200, "My window title" ); Fl_Box box( 0, 50, 200, 20, "Hello" ); window.show(); return Fl::run(); }项目右键Properties,需要做以下几个修改,需要注意的是Release和Debug都需要进行设置
Configuration Properties C/C++ Code Generation Runtime Library Multi-threaded Debug DLL (/MDd) Linker Input Additional Dependecies fltk.lib fltkimages.lib fltkjpeg.lib fltkpng.lib fltkzlib.lib fltkgl.lib fltkforms.lib Ignore Specific Default Libraries libcd.lib现在我们可以Build并运行了,如果可以正常运行就表示我们安装成功了。
转载于:https://www.cnblogs.com/lkpp/p/Installing-FLTK-with-VisualStudio.html