我正在用QtCreator做一个FLTK GUI。请不要因为我没有使用Qt来制作我的GUI而生气,这是无关紧要的。
无论如何,我的项目类型是“普通C++项目”,这是我的代码(你可能不需要阅读它,但我把它放在那里以防万一):
// include headers
#include <Windows.h>
#include <Fl/Fl.H>
#include <FL/FL_Window.h>
#include <FL/Fl_Button.h>
#include <FL/FL_ask.h>
// macro functions
#define UP(x) UNREFERENCED_PARAMETER(x)
// callback function
void callback(Fl_Widget *sender)
{
sender->label("Thanks!");
}
// main function
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nShowCmd)
{
// UP's
UP(hInstance);
UP(hPrevInstance);
UP(lpCmdLine);
UP(nShowCmd);
// window
Fl_Window *window = new Fl_Window(250, 250, "Derp Window");
window->begin();
// button
Fl_Button *button = new Fl_Button(10, 100, 230, 25, "Click Me!");
button->callback(callback);
// run
window->end();
window->show();
int result = Fl::run();
// delete ptr's
delete button;
delete window;
// return
return result;
}当我运行这个程序时,我得到了这个警告和两个错误(对于小图像很抱歉,如果你看不到它,就放大你的浏览器):

我知道什么是LNK2019错误,事实上,它们可能是我存在的祸根。但在这种情况下,我不知道为什么我会得到这个。我认为你也应该看看这个,这是我的Qt项目.pro文件的文本:
模板=应用配置+=控制台配置-= app_bundle配置-= qt
win32: LIBS += -luser32 -lshell32 -lgdi32 -lole32 -ladvapi32
SOURCES += main.cpp
unix|win32: LIBS += -L$$PWD/../桌面/C++/FLTK/lib/ -lfltk
INCLUDEPATH += $$PWD/../Desktop/C++/FLTK/include DEPENDPATH += $$PWD/../Desktop/C++/FLTK/include
这可能是最重要的部分:我从来没有收到任何错误,当我使用int main()作为我的主函数时,程序运行得很好。
所以,我的问题是,为什么我会得到这个问题,我该如何修复它?
发布于 2012-11-30 06:49:30
我通过创建“空Qt项目”而不是"C++控制台应用程序“修复了它!
发布于 2012-11-28 11:00:55
删除语句
配置+=控制台
https://stackoverflow.com/questions/13594719
复制相似问题