visual studio 2008 - ATL project created using wizard does not compile due to unresolved symbols -


I'm working to get basic ATL projects to be compiled in Visual Studio 2008 and I'm running in errors I am Eventually I was stuck with the following build errors:

  1> Linking ... 1 & gt; Library debug \ SomeProject.lib and object debug \ SomeProject.exp 1 & gt; Dllmain.obj: Error LNK2001: Unsolved External Symbol _LIBID_SomeProjectLib 1 & gt; SomeObject.obj: Error LNK2001: Unsolved External Symbol _LIBID_SomeProjectLib 1 & gt; SomeObject.obj: Error LNK2001: Unsolved External Symbol _IID_ISomeObject 1 & gt; Debug \ SomeProject.dll: Fatal error LNK1120: 2 unsolved embedded  

What am I seeing or doing wrong? These steps are given to reproduce.

  1. Create a new ATL project named SomeProject . Accept all the mistakes.
  2. Right-click the project in the Solution Explorer and click Add & gt; Class .
  3. Enter ATL Simple Object and enter SomeObject as its code Accept all other defaults.

The project fixes at this point. However, I want to split my IDL into multiple files for better organization (my IDL will be thousands of lines long).

  1. Right-click on the project and select Add & gt; New item . Choose
  2. middle file and enter ISomeObject as its code.
  3. Open some projects .idl and ISomeObject cut the Interface Announcement. Change it to import "ISomeObject.idl" .
  4. Paste the Interface Announcement in ISomeObject.idl .

To satisfy the Microsoft's IDL compiler, we need to change some options:

  1. Right-click on the project and open its properties < Code> MIDL> Go to the Output section and enter the following value:
    • Header file: $ (input name). H
    • ID file: $ (InputName) _i.cpp
    • Proxy file: $ (input name) _p.cpp < / Code>
    • Generate Type Library: No
    • Go to C / C ++> Precompiled Headers Do not use precompiled header from section and set create / use precompiled header . Later errors are if precomputed headers are used.
    • Select the SomeProject.idl file so that its properties can be displayed. MIDL & gt; Go to Output section and set to Library to Yes .
    • Remove someProject_i.h and SomeProject_i.c to the generated files .
    • Add existing code to generated files filter You may have to try to compile the project first
      • SomeProject.h < / Code>
      • SomeProject_i.cpp
      • ISomeObject.h
      • ISomeObject_i.cpp But this is not you should get the LNK1120 errors listed at the top of this question

        Any thoughts? Am I looking something simple?

Not sure what you are doing, or why you are doing this, but somewhere You have lost the blah_i.c source code file which generates midl.exe, which contains GUIDs of interfaces, cockles and type libraries about which the linker is complaining about. If you can not find it back, then search for MIDL_DEFINE_GUID in * .c files.

EDIT: I see the problem now, you named blah_i.c as blah_i.cpp. This is incorrect, there are C announcements in the file. Compiler connects identifiers differently when it is compiled as a C ++ code, rename it back. C. Or use the / TC compilation option.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -