通过CL命令执行Win32应用程序 [英] Executing Win32 application via CL command

查看:103
本文介绍了通过CL命令执行Win32应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
这不是我的转发,
我从MFC应用程序执行Win32应用程序的问题中得到了解决方案
以下问题
使用命令提示符编译WIN32应用程序 [从mfc应用程序编译WIN32应用程序 [ CPallini [

Hi All,
this is not my repost,
I got solution on my question of executing Win32 application from MFC aplication
which is following questions
Compiling WIN32 application using Command Prompt[^]
and
Compiling WIN32 Application from mfc application[^]

using CL command as per CPallini[]

Suggestion.
Thing work fine still single file complilation like Win32 project has on .cpp file compile this .cpp file and get exe.

But problem arises for dependance,
that in main() method of Win32 API if i used function AddTwoNumber() a member function of CTrailABC in TrailABC.cpp and TrailABC.h files

now when i execute The main file using CL command i get .obj file correct but while creating exe file i get linking error like,

unresolved symbol AddTwoNumber()




我的文件还包含.h文件,因此如何在不创建.h obj文件的情况下链接.h文件(因为未创建.h文件的.obj文件)
[/EDIT]




My Files also contain .h files so how to link .h file without creating obj file of .h (Because .obj file of .h file is not created)
[/EDIT]

推荐答案

您需要将链接器选项添加到CL命令中;请参见此处 [
You need to add the linker options to your CL command; see here[^].


作为Richard(好的)建议的替代方案,您可以调用CL传递所需的所有源文件名,例如
As an alternative to Richard (good) suggestion, you may invoke CL passing all the source filenames you need, e.g.
CL main.cpp auxsrc1.cpp auxsrc2.cpp ...


这篇关于通过CL命令执行Win32应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆