Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi All,
I was created a MDI(Multi Document Interface) application in mfc and i want run this MFC application from visual studio command prompt.
I used cl and link command to do so.
 
i'm created batch file having following content
cl /c /MD Trial.cpp
cl /c /MD MaiFrm.cpp
cl /c /MD TrialDoc.cpp
cl /c /MD ChildFrm.cpp
cl /c /MD TrialView.cpp
cl /c /MD stdafx.cpp
link Trial.obj MainFrm.obj TrialDoc.obj ChildFrm.obj TrialView.obj stdafx.obj

 
compilation of all .cpp files work fine but problem arises while linking.
 
Execution of above batch file gives me Error Like:
 
LINK : fatal error LNK1561: entry point must be defined
on command prompt
 
So, what is alternative to create executable of MFC application via command line
Posted 21-Sep-11 20:58pm
Edited 23-Sep-11 2:35am
v4
Comments
johny10151981 at 22-Sep-11 5:59am
   
If you have built an MFC application then you are not suppose to get an error like this.
 
Please check the configuration of the project, Make sure the configuration is MFC.
 
Besides If you forget to create the Object then your program will create and Error, I forgot the Name.....
Coder Block at 23-Sep-11 5:18am
   
Hey Johny,
I'm still get confused on cl command and what your saying
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You seem to be confused between building a program and running it. What you are doing (or trying to do) above is build the program from the command line, but I see no benefit in this since Visual Studio can do it automatically. You also seem to think that setting SUBSYSTEM:CONSOLE is correct for a MDI application, which must always be SUBSYSTEM:WINDOWS.
 
Perhaps you should explain more clearly what your program is supposed to do, and why you think building from the command line will help in any way.
  Permalink  
Comments
Coder Block at 23-Sep-11 6:02am
   
I want just create executable and about
SUBSYSTEM:CONSOLE,
If used SUBSYSTEM:WINDOWS then i still above errors
Richard MacCutchan at 23-Sep-11 6:12am
   
You cannot create an MFC MDI application using SUBSYSTEM:CONSOLE, you must use SUBSYSTEM:WINDOWS as I stated above. Your link errors are occurring because you have not included the base system libraries that are required by a Windows MFC application. Try creating a simple MFC app from Visual Studio and look in the project properties to see which libraries are required, and make sure you include them in your build process.
 
Coder Block at 23-Sep-11 7:34am
   
Hey nice one i tried all complile opion from property window igot my solution
 
Thank you very much,
 
For valuble guidence
Richard MacCutchan at 23-Sep-11 7:47am
   
Happy to help.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You need a main function. Take a look at the following links :
 
MSDN : LNK1561
 
LNK 1561: Entry point must be defined (Also: LNK2019)
  Permalink  
Comments
Coder Block at 22-Sep-11 2:45am
   
I have tried this with SUBSYSTEM:CONSOLE likelink SUBSYSTEM:CONSOLE Trial.obj MainFrm.obj TrialDoc.obj ChildFrm.obj TrialView.obj stdafx.obj
 
but again i got error likenafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
nafxcwd.lib(olelink.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(dcmeta.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(timecore.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(oledlgs1.obj) : error LNK2001: unresolved external symbol __mbctype
.\Debug/OILink.exe : fatal error LNK1120: 3 unresolved externals

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 195
1 ProgramFOX 130
2 Maciej Los 105
3 Afzaal Ahmad Zeeshan 82
4 Sergey Alexandrovich Kryukov 75
0 OriginalGriff 6,564
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 23 Sep 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100