Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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<br />
cl /c /MD MaiFrm.cpp<br />
cl /c /MD TrialDoc.cpp<br />
cl /c /MD ChildFrm.cpp<br />
cl /c /MD TrialView.cpp<br />
cl /c /MD stdafx.cpp<br />
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:

<big>LINK : fatal error LNK1561: entry point must be defined</big>
on command prompt

So, what is alternative to create executable of MFC application via command line
Posted
Updated 23-Sep-11 1:35am
v4
Comments
Mohibur Rashid 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 23-Sep-11 5:18am    
Hey Johny,
I'm still get confused on cl command and what your saying

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.
 
Share this answer
 
Comments
Coder Block 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 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 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 23-Sep-11 7:47am    
Happy to help.
You need a main function. Take a look at the following links :

MSDN : LNK1561

LNK 1561: Entry point must be defined (Also: LNK2019)
 
Share this answer
 
Comments
Coder Block 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900