I added a dll project to my solution and explicitly referenced it by an executable project. The executable is complaining that it can’t find the lib.
Any ideas how to set the project to create the required lib file? And prehaps why the project would not create one?!?
Cheers
NOTE I have searched the project and the file isn’t being created anywhere.
In the Linker -> Advanced property tab of the DLL project, verify that the value for Import Library (the .lib file you are looking for) is correct/reasonable. The value of this property will determine what the import library is named, and where the linker will write it to.
You may also need to generate an imports definition file (.def) in your project, or check your header files and make sure your exported functions are tagged with the __declspec(dllexport) qualifier in the header file. This is usually toggled by a #define such as:
Basically you want the compiler to see dllexport when it is building the library, but dllimport when your client code is #including the header file. If Visual Studio generated the basic project structure, it probably already created a suitable #define to use.
You do not have to both create the .def file and add the dllexport, just one or the other. I prefer the latter. Also, if you choose to use a .def file, you need to specify it in the Linker properties of your library project.