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 8657791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:36:33+00:00 2026-06-12T15:36:33+00:00

I have all the necessary MFC libraries, they are all in a directory called

  • 0

I have all the necessary MFC libraries, they are all in a directory called ‘atlmc’. I have creates a copied a simple helloworldmfc.cpp from http://social.msdn.microsoft.com/Forums/en-US/vcmfcatl/thread/c8556098-6f41-42cb-9de6-38ed24c3faf9

Here is the code:

#include <afxwin.h>

  class HelloApplication : public CWinApp
  {
  public:     
   virtual BOOL InitInstance();
  };

  HelloApplication HelloApp;

  class HelloWindow : public CFrameWnd
  {        
   CButton* m_pHelloButton;
  public:     
   HelloWindow();
  };


  BOOL HelloApplication::InitInstance()
  {        
   m_pMainWnd = new HelloWindow();       
   m_pMainWnd->ShowWindow(m_nCmdShow);      
   m_pMainWnd->UpdateWindow();      
   return TRUE;
  }


  HelloWindow::HelloWindow()
  {        
   Create(NULL,             
    "Hello World!",               
    WS_OVERLAPPEDWINDOW|WS_HSCROLL,                
    CRect(0,0,140,80));        
   m_pHelloButton = new CButton();
   m_pHelloButton->Create("Hello World!",WS_CHILD|WS_VISIBLE,CRect(20,20,120,40),this,1);
  }

I have linked every library file etc that the linker asks for, there are a lot of them. Here is my build command:

C:\Users\Scruffy\Desktop\MSVC>Bin\cl.exe hellomfc.cpp /EHsc /I
atlmfc\include /I Includes /I Includes\Winsdk
atlmfc\lib\amd64\nafxcw.lib Libs\libcmt.lib Libs\Ke rnel32.Lib
Libs\User32.Lib Libs\Gdi32.Lib Libs\MSImg32.Lib Libs\ComDlg32.Lib Lib
s\WinSpool.Lib Libs\AdvAPI32.Lib Libs\Shell32.Lib Libs\ComCtl32.Lib
Libs\ShLwApi .Lib Libs\Uuid.lib atlmfc\lib\amd64\atls.lib
Libs\Ole32.Lib Libs\OleAut32.Lib Li bs\oldnames.lib Libs\WS2_32.Lib
Libs\MsWSock.Lib Libs\OleAcc.Lib Libs\comsuppw.l ib Libs\GdiPlus.lib
Libs\Imm32.Lib Libs\WinMM.Lib Libs\MsXml2.Lib Libs\OleDlg.L ib
Libs\Urlmon.Lib

the compilers response complains about __tmainCRTStartup not being found. As well as some other thing about _WIN32_WINNT not being defines, although that just seems to be a warning, not an error.

Here is the full response from cl.exe after I run my build command through it:

Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

hellomfc.cpp
_WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h) Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.

/out:hellomfc.exe
hellomfc.obj atlmfc\lib\amd64\nafxcw.lib
Libs\libcmt.lib Libs\Kernel32.Lib Libs\User32.Lib Libs\Gdi32.Lib
Libs\MSImg32.Lib Libs\ComDlg32.Lib Libs\WinSpool.Lib Libs\AdvAPI32.Lib
Libs\Shell32.Lib Libs\ComCtl32.Lib Libs\ShLwApi.Lib Libs\Uuid.lib
atlmfc\lib\amd64\atls.lib Libs\Ole32.Lib Libs\OleAut32.Lib
Libs\oldnames.lib Libs\WS2_32.Lib Libs\MsWSock.Lib Libs\OleAcc.Lib
Libs\comsuppw.lib Libs\GdiPlus.lib Libs\Imm32.Lib Libs\WinMM.Lib
Libs\MsXml2.Lib Libs\OleDlg.Lib Libs\Urlmon.Lib libcmt.lib(crt0.obj) :
error LNK2019: unresolved external symbol main referenced in function
__tmainCRTStartup hellomfc.exe : fatal error LNK1120: 1 unresolved externals

so error LNK2019: unresolved external symbol main referenced in function __tmainCRTStartup hellomfc.exe : fatal error LNK1120: 1 unresolved externals
Seems to be the problem. This error basically means that the compiler cannot find an entry point, does it not? If so, MFC apparently has its WinMain burried somewhere in the framework. OK fine, how do I link to it?

  • 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-12T15:36:34+00:00Added an answer on June 12, 2026 at 3:36 pm

    It appears you may not be specifying the correct target platform (Windows vs Console) and the latter isn’t being linked in.

    Try specifying /SUBSYSTEM:WINDOWS on your command line to tell the linker which startup proc to use. It is a linker flag so it needs to be passed through to the link-phase via /link.

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

Sidebar

Related Questions

I'm trying to run MonoDevelop on apple. I have instaled all the necessary SDK
I have designed one sign-up form,in this form after getting all necessary values I
In case I have .NET framework installed in my computer + all the necessary
I have all my user uploaded pictures in a directory outside of the public
I have all the necessary files and structures in order to handle CRUD operations
I have included all the necessary files in my app (.h and .m files
I have all the necessary code to move and click the mouse via C#
I am busy recreating a powerpoint with xml. i have added all the neccessary
I have all the parameters fixed to describe one plot including oma , mar
I have all dates stored as timestamps (int) in the database. how can I

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.