As in the title, I am trying to create a DLL using C and associate it with a C ++ project. I read and followed various textbooks on the Internet, but every time something is missing, and I do not understand that.
Here is what I did, step by step:
I created a new Win32 project called testlib, then from the wizard I selected "DLL" and "Empty project".
Added caption:
#include <stdio.h>
__declspec(dllexport) void hello();
Added source; since I want it to be the source of C that I read, I should just rename the .cpp file to .c, so
#include "testlib.h"
void hello() {
printf("DLL hello() called\n");
}
Designed by.
Now I would like to use my useful dll in another project.
Then: new project ( testlibUse). This time I selected "Empty project".
No need to add header, just create cpp source
#include <testlib.h>
int main() {
hello();
}
Then:
, :
LINK: C:\path\testlibUse\Debug\testlibUse.exe ;
main.obj: LNK2019: "void __cdecl hello (void)" (? hello @@YAXXZ), _main
C:\path\testlibUse\Debug\testlibUse.exe: LNK1120: 1
testlib, testlib.c testlib.cpp dll, testlibUse, "dll not found".
"Release" ( , ), .
, , , .
?
, - , , DLL Qt?