我一直在努力在视力演播室2008年编辑一个基本的ATL项目,我仍然有错误。 最后,我ten着以下建筑错误:
1>Linking...
1> Creating library DebugSomeProject.lib and object DebugSomeProject.exp
1>dllmain.obj : error LNK2001: unresolved external symbol _LIBID_SomeProjectLib
1>SomeObject.obj : error LNK2001: unresolved external symbol _LIBID_SomeProjectLib
1>SomeObject.obj : error LNK2001: unresolved external symbol _IID_ISomeObject
1>DebugSomeProject.dll : fatal error LNK1120: 2 unresolved externals
我对什么视而不见或做什么错误? 这里是复制步骤。
- Create a new
ATL Project
namedSomeProject
. Accept all defaults. - Right-click the project in the Solution Explorer and select
Add > Class
. - Select
ATL Simple Object
and enterSomeObject
as its Short Name. Accept all other defaults.
在这一点上,该项目建了罚款。 然而,我想把我的身份证分成多个档案,以便更好地组织起来(我的IDL是数千条线长)。
- Right-click the project and select
Add > New Item
. - Select
Midl File
and enterISomeObject
as its filename. - Open
SomeProject.idl
and cut theISomeObject
interface declaration. Replace it withimport "ISomeObject.idl";
. - Paste the interface declaration in
ISomeObject.idl
.
为了满足微软的IDL编辑,我们需要改变一些选择:
- Right-click the project and open its Properties. Go to the
MIDL > Output
section and enter the following values:- Header File:
$(InputName).h
- IID File:
$(InputName)_i.cpp
- Proxy File:
$(InputName)_p.cpp
- Generate Type Library:
No
- Header File:
- Go to the
C/C++ > Precompiled Headers
section and setCreate/Use Precompiled Header
toNot using Precompiled Header
. There are errors later if precompiled headers are used. - Select the
SomeProject.idl
file so that its properties are displayed. Go to theMIDL > Output
section and setGenerate Type Library
toYes
. - Remove
SomeProject_i.h
andSomeProject_i.c
from theGenerated Files
filter. - Add the following Existing Items to the
Generated Files
filter. You may need to attempt to compile the project first.SomeProject.h
SomeProject_i.cpp
ISomeObject.h
ISomeObject_i.cpp
现在,我现在期待该项目汇编成册。 但它没有。 您应获得我在此问题顶端列出的<代码>LNK1120错误。
任何想法? 我只想看什么简单?