Share via

Why no .lib file when creating a Dynamic Link Library? Is there supposed to be one?

CDev-8220 470 Reputation points
2025-10-13T19:26:14.9066667+00:00

I created a project (Dynamic Link Library (dll)), and added a reference to it in my main project.

I am getting an error:

cannot open file 'DummyModule.lib'

I did build the project, but there is no file 'DummyModule.lib' anywhere on my computer. There is a .dll file 'DummyModule.dll'.

Did something go wrong? Should there be a .lib file as well?

Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.

0 comments No comments

Answer accepted by question author

Darran Rowe 2,616 Reputation points
2025-10-13T19:59:30.9266667+00:00

Not by default, no. The import library is only created when you export a symbol. So this means using the __declspec(dllexport) storage class specifier, a module definition file with an EXPORTS section, or the /EXPORT linker command line option for a symbol (function or data) defined in the DLL.

Just create a DLL project in Visual Studio, but make sure to set it to "Export symbols" but don't set it to empty. Then check what the sample project does.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.