从命令提示符运行MFC应用程序 [英] Running MFC aplication from command prompt
问题描述
大家好,
我在MFC中创建了MDI(多文档界面)应用程序,我想从Visual Studio命令提示符下运行此MFC应用程序.
我使用cl和link命令这样做.
我创建了具有以下内容的批处理文件
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
所有.cpp文件的编译都可以正常工作,但是在链接时会出现问题.
上面的批处理文件的执行给了我类似的错误:
<big>LINK : fatal error LNK1561: entry point must be defined</big>
在命令提示符下
因此,通过命令行创建MFC应用程序可执行文件的替代方法是什么
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
推荐答案
您似乎在构建程序与之间感到困惑>运行它.上面您正在执行的操作(或尝试执行的操作)是从命令行构建程序,但由于Visual Studio可以自动执行此操作,因此我看不到任何好处.您似乎还认为设置SUBSYSTEM:CONSOLE
对于MDI应用程序是正确的,该应用程序必须始终必须为SUBSYSTEM:WINDOWS
.
也许您应该更清楚地解释程序应该执行的操作,以及为什么认为从命令行进行构建将以任何方式提供帮助.
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 settingSUBSYSTEM:CONSOLE
is correct for a MDI application, which must always beSUBSYSTEM: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.
您需要一个main
函数.看一下以下链接:
MSDN:LNK1561
LNK 1561:必须定义入口点(也:LNK2019 )
You need amain
function. Take a look at the following links :
MSDN : LNK1561
LNK 1561: Entry point must be defined (Also: LNK2019)
这篇关于从命令提示符运行MFC应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!