Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8489867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:56:49+00:00 2026-06-10T21:56:49+00:00

I have a project which was created for MinGW + Qt via cmake. In

  • 0

I have a project which was created for MinGW + Qt via cmake.
In CMakeLists.txt I have

add_executable (project-name WIN32 ${MOC_SRCS} ${HEADERS} ${SOURCES} ${RESOURCES} ${QtApp_RCC_SRCS})

If I try to compile it into VisualStudio 2010 I get the following linker error:

MSVCRTD.lib(crtexew.obj) : error LNK2019: undefined reference _WinMain@16 in func ___tmainCRTStartup

Then I erase WIN32

add_executable (project-name ${MOC_SRCS} ${HEADERS} ${SOURCES} ${RESOURCES} ${QtApp_RCC_SRCS})

The project compiles and works fine, but I have an a console window with a Qt window. How to disable the console?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:56:51+00:00Added an answer on June 10, 2026 at 9:56 pm

    Using WIN32 within add_executable means your application will be of the type SUBSYSTEM:WINDOWS. That is, an application which does not require a console. If this is specified then, rather than a main(...), a WinMain(...) (which has different arguments from a main) is expected. Since your code most likely does not have this, you get the linker error you report.

    Removing WIN32 means your executable will be of the default type SUBSYSTEM:CONSOLE, which explains why your application works, but a console is shown.

    So to fix it, do specify WIN32 but change your main() to a WinMain().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created data sources from my objects in my project, some of which
I have created a wix installer project which is working fine. It installs my
I have created a large Visual C++ 10.0 project which builds nicely within the
I have created a dataset in my visual studio project which is connected to
I have created a unit test in my c# project which builds into a
I have the problem running executable .jar file. I've created a project which contains
When I have an Eclipse update site project, a site.xml file is created which
I would like to deplay a django application/project, which i have created within Aptana.
i have created a simple public ref class in the vc++ project, which is
In my project, I have created a code snippet which can be copied and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.