Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error linking with MFC library _tWinMain
Qt 6.12 LTS is out! See what's new in the release blog

Error linking with MFC library _tWinMain

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 584 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by
    #1

    I've just deleted the:

    int WINAPI _tWinMain(HINSTANCE hInstance,  // handle to current instance
       HINSTANCE hPrevInstance,  // handle to previous instance
       LPTSTR lpCmdLine,      // pointer to command line
       int nCmdShow          // show state of window
       );
    

    from my source code and relinked the application so I pick up the _tWinMain in appmodul.cpp (MFC library code).

    My problem is that I now get:

    1>qtmaind.lib(qtmain_win.obj) : error LNK2001: unresolved external symbol main
    1>C:\Users\amonra\Documents\GitHub\DSS\x64\Debug\DeepSkyStacker.exe : fatal error LNK1120: 1 unresolved externals
    

    What is the solution?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      Where is main() in your code?

      1 Reply Last reply
      1
      • PerdrixP Offline
        PerdrixP Offline
        Perdrix
        wrote on last edited by
        #3

        It was in the MFC library code that I linked specifically in appmodul.cpp (see MFC source). I since reinstated a main in my own code, which bypassed the problem.

        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