I have a LNK2019 problem when trying to use some DLL in my project.
Details:
__d
Just a guess:
If you include the header from dll1 in the dll2 project and in that header you use the __declspec(dllexport))
you tell the linker that dll2 is also exporting these classes that actually are meant to be imported by dll2 and so is missing classes definition.
So one would ususally use a definition like this.
#ifdef DLL1_EXPORTS
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
class DLLEXPORT A
{
//...
This construction makes sure, the dll1 definitions are exported when the header is used in dll1 and imported when used inside dll2 project. All you need is the macro DLL1_EXPORT
to be defined when dll1 is compiled. The project settings for dll1 is usually a good place.
Another approach is to have 2 different headers, one for building dll1 and a second to be used together wit dll1's lib (without any __declspec(dllexport)
).