I'm making a FLTK GUI in QtCreator. Please don't get angry at me for not using Qt to make my GUI, it's irrelevant.
Anyway, my project type is "Plain C++ Project", and this is my code (You probably don't need to read it, but I put it there just in case):
// 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;
}
When I run this, I get this warning, and two errors (Sorry about the small image, just zoom in your browser if you can't read it):
I know what a LNK2019 error is, in fact they are probably the bane of my existence. But in this case I have no idea why I am getting this. I think that you should also look at this, it's the text for my Qt projects .pro file:
TEMPLATE = app CONFIG += console CONFIG -= app_bundle CONFIG -= qt
win32: LIBS += -luser32 -lshell32 -lgdi32 -lole32 -ladvapi32
SOURCES += main.cpp
unix|win32: LIBS += -L$$PWD/../../../Desktop/C++/FLTK/lib/ -lfltk
INCLUDEPATH += $$PWD/../../../Desktop/C++/FLTK/include DEPENDPATH += $$PWD/../../../Desktop/C++/FLTK/include
This is probably the most important part: I never get any errors, and the program runs fine when I use int main() as my main function.
So, my question is why am I getting this, how do I fix it?
I fixed it by making an "Empty Qt Project" instead of a "C++ Console Application"!