-1

I have a large Visual Studio project with C and C++ code. The Target Extension is .dll and the Configuration Type is Dynamic Link Library. It builds the .dll just fine and outputs tons of .obj files. How do I get Visual Studio to give me one .lib (object library) file instead of tons of .obj files?

I've tried entering a value for the Import Library option but it doesn't change anything. I need the .lib because when I create a new test program referencing my .dll I get tons of error LNK2001: unresolved external symbol errors, which indicates that I need the object library.

Close vote: this question is well within What topics can I ask here?

Community
  • 1
  • 1
Mike S
  • 11,329
  • 6
  • 41
  • 76
  • 5
    If it creates a .dll but not a .lib, that *usually* means that you haven't exported anything from your dll. – Jerry Coffin Nov 02 '16 at 23:25
  • 1
    You will *always* get .obj files, the compiler needs to create them. Then they get linked to produce the final .dll file. If you don't see a .lib file at all then you forgot to export anything. Use `__declspec(dllexport)` or a .def file. – Hans Passant Nov 03 '16 at 09:46
  • @HansPassant I need to export the entire project. I'm trying to create a library that can be used by another application. Does Visual Studio have an option to export the whole thing? – Mike S Nov 03 '16 at 15:38

1 Answers1

0

Does your dll have any actual exports? If there are no , the linker will not generate an import library .lib file.

Cherkesgiller
  • 520
  • 4
  • 17