Libraries Conflict, SDL and Qt
I tried to use SDL to access my joystick and use Qt for GUI. However, I got this error when I compile the code.
SDLmain.lib(SDL_win32_main.obj):-1: error: LNK2005: _WinMain@16 already defined in qtmaind.lib(qtmain_win.obj)
I am using Qt 5.1.0 and SDL 1.2.15
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = joystick_GUI
TEMPLATE = app
LIBS += -L"C:/libs/SDL-1.2.15/lib/x86" -lSDL -lSDLmain
INCLUDEPATH += C:/libs/SDL-1.2.15/include
SOURCES += main.cpp
HEADERS += joystick_gui.h
FORMS += joystick_gui.ui
Hi, I am not familiar with SDL, but you can give a try to add following lines to your pro file, then run qmake
QMAKE_LFLAGS += $$QMAKE_LFLAGS_WINDOWS
That works! but do you mind explain to me what each line does?
The other way around is removing qtmain from build.
Ok, I write a blog right now.
hope it's useful for you.
Your blog is very informative, thank you so much!