从空项目开始创建com库 [英] Creating com library with starting from empty project

查看:109
本文介绍了从空项目开始创建com库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在MSDN中找到了一个名为使用文本编辑器创建COM服务器的示例。
http://msdn.microsoft。 com / en-us / library / 2wad1c0e(v = vs.71).aspx



它从命令promt编译,但不是从Visual Studio IDE 。



我决定将此项目移动到Visual Studio。
我已经创建了新项目(文件>>新建>>项目>>空项目),并将MyServer.cpp文件添加到源文件和MyIncludes.h到标题文件。我在尝试构建项目时遇到以下错误:

  1> ------开始:项目:Myserver,配置:发布Win32 ------ 
1>编译...
1> MyServer.cpp
1> .\MyServer.cpp(26):警告C4581: :'apartment'代替'apartment'来处理属性
1>链接...
1>创建库C:\Myserver\Release\Myserver.lib和对象C:\Myserver\Release\Myserver.exp
1> LINK:致命错误LNK1561:必须定义入口点
1>构建日志保存在file:// c:\Myserver\Myserver\Release\BuildLog.htm
1> Myserver - 1错误,1警告
========= Build:0成功,1失败,0最新,0跳过==========



如何解决这个问题?

解决方案

翻译错误告诉你需要在EXE模块中的入口函数。
您必须定义 main(...)函数作为条目,否则是无效的EXE,因为没有启动点。
简单来说,你可以为IDE创建一个控制台窗口项目,或者只是手动添加 main(...)


. I found sample called "Creating a COM Server Using a Text Editor" in MSDN. http://msdn.microsoft.com/en-us/library/2wad1c0e(v=vs.71).aspx

It compiles fine from command promt, but not from Visual Studio IDE.

I decided to move this project to Visual Studio. I have created new project (File>>New>>Project>>Empty project) and add MyServer.cpp file to "Source Files" and MyIncludes.h to Header Files. I got following error after I tried to build project:

1>------ Build started: Project: Myserver, Configuration: Release Win32 ------
1>Compiling...
1>MyServer.cpp
1>.\MyServer.cpp(26) : warning C4581: deprecated behavior: '"apartment"' replaced with 'apartment' to process attribute
1>Linking...
1>   Creating library C:\Myserver\Release\Myserver.lib and object C:\Myserver\Release\Myserver.exp
1>LINK : fatal error LNK1561: entry point must be defined
1>Build log was saved at "file://c:\Myserver\Myserver\Release\BuildLog.htm"
1>Myserver - 1 error(s), 1 warning(s)
 ========= Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

How to solve this problem?

解决方案

The translation errors told you need a entry function in an EXE module. you must define a main(...) function as the entry, otherwise is an invalid EXE since there is no startup point. Simply, you can create an console window project for IDE, or just add main(...) manually as I said.

这篇关于从空项目开始创建com库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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