http://www.cppblog.com/cyantree/archive/2012/05/13/174761.html 新手入门
1 include Directories fltk
2 Library Directories fltk\lib
3 Linker -> input
fltk.lib
fltkforms.lib
fltkgl.lib
fltkimages.lib
fltkjpeg.lib
fltkpng.lib
fltkzlib.lib
或 (代码中增加)
#pragma comment(lib,"fltk.lib")
#pragma comment(lib,"fltkforms.lib")
#pragma comment(lib,"fltkgl.lib")
#pragma comment(lib,"fltkimages.lib")
#pragma comment(lib,"fltkjpeg.lib")
#pragma comment(lib,"fltkpng.lib")
#pragma comment(lib,"fltkzlib.lib")
4 Linker -> All Options -> SubSystem
Windows(/SUBSYSTEM:WINDOWS)
备注: C/C++ -> Code Generation -> Runtime Library MT(静态) MD(动态)
MT ERROR
静态编译需用引入静态库
动态编译引入动态库
VC中,切换到"解决方案视图",--->选中要添加lib的工程-->点击右键-->"添加"-->"现有项"-->选择lib文件-->确定.
fltk 静态编译报错对报错模块添加
Linker -> Input -> Ignore Specific Default Libraries
添加 msvcrt.lib
FLTK控制台程序修改为窗口程序
连接器->高级->入口点->mainCRTStartup
连机器->系统->子系统->windows
例:
1. c/c++ -> 代码生成 -> 运行库 MT
2. 添加现有项目 fltk lib文件夹
3. fltk下的FL放入Microsoft Visual Studio 14.0\VC\include\
4. Main.cpp
#include <iostream>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
using namespace std;
void but_cb(Fl_Widget* o, void*) {
}
int main(int argc, char **argv){
Fl_Window win(300, 200, "zf");
win.begin();
Fl_Button but(10, 150, 70, 30, "Click");
win.end();
but.callback(but_cb);
win.show();
return Fl::run();
}