Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Libraries Conflict, SDL and Qt
Qt 6.12 LTS is out! See what's new in the release blog

Libraries Conflict, SDL and Qt

Scheduled Pinned Locked Moved 3rd Party Software
5 Posts 2 Posters 6.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi,

    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

    Thank you

    @
    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
    joystick_gui.cpp
    joystick.cpp

    HEADERS += joystick_gui.h
    joystick.h

    FORMS += joystick_gui.ui
    @

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dbzhang800
      wrote on last edited by
      #2

      Hi, I am not familiar with SDL, but you can give a try to add following lines to your pro file, then run qmake

      @
      CONFIG-=windows
      QMAKE_LFLAGS += $$QMAKE_LFLAGS_WINDOWS
      @

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        That works! but do you mind explain to me what each line does?

        Thank you

        The other way around is removing qtmain from build.
        @
        QMAKE_LIBS_QT_ENGTRY =
        @

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dbzhang800
          wrote on last edited by
          #4

          Ok, I write a blog right now.

          http://blog.debao.me/2013/07/link-confilict-between-sdl-and-qt-under-windows/

          hope it's useful for you.

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            Your blog is very informative, thank you so much!

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt
            • Unsolved