N
NvrBst
I have C99 code (which I changed extensions to .cpp to compile as C+
+98). Which is does fine.
I create a Static Library Project (.lib) and Build, and it builds
the .obj files (9 of them) and makes the .lib.
I change the project to a Dynamic Linked Library (.dll), and then try
to compile and it makes all the .obj files, but fails with making the
DLL with a LINKER ERROR.
clib.obj : error LNK2019: unresolved external symbol _timer referenced
in function "void __cdecl cls_aprod(struct CLS *,int,int,int *
const,double * const,double * const)" (?
cls_aprod@@YAXPAUBCLS@@HHQAHQAN2@Z)
cls.obj : error LNK2001: unresolved external symbol _timer
clsqr.obj : error LNK2001: unresolved external symbol _timer
Debug\cls.dll : fatal error LNK1120: 1 unresolved externals
I exclude a few of the .cpp files that reference the timer function,
and re-build, and I get LNK errors again about other functions that
are in the project, but not in that .obj file (ie functions that
reference the other name.cpp files through the #include name.h ).
It seems like the DLL is not linking the functions from the other .cpp
files in the folder. If i remove everything and just try to make a
dll with 1 of the files (that do not reference any other functions)
like timer.cpp, it will make the timer.dll fine.
Once I try to make a DLL from a file like cls.cpp (which refrences the
timer.h) it fails with the __timer external symbol unresolved.
But it manages to link them all together fine with the Static Library
(.lib) project? How can I get this to compile as a DLL if I wish to?
How do I tell Visual Studio to make the dll with linking to the other
files in the project like the lib does?
I have played around with some of the options in the DLL Properties >
Linker >> (General/Input) tabs... but no success.
Thanks!
+98). Which is does fine.
I create a Static Library Project (.lib) and Build, and it builds
the .obj files (9 of them) and makes the .lib.
I change the project to a Dynamic Linked Library (.dll), and then try
to compile and it makes all the .obj files, but fails with making the
DLL with a LINKER ERROR.
clib.obj : error LNK2019: unresolved external symbol _timer referenced
in function "void __cdecl cls_aprod(struct CLS *,int,int,int *
const,double * const,double * const)" (?
cls_aprod@@YAXPAUBCLS@@HHQAHQAN2@Z)
cls.obj : error LNK2001: unresolved external symbol _timer
clsqr.obj : error LNK2001: unresolved external symbol _timer
Debug\cls.dll : fatal error LNK1120: 1 unresolved externals
I exclude a few of the .cpp files that reference the timer function,
and re-build, and I get LNK errors again about other functions that
are in the project, but not in that .obj file (ie functions that
reference the other name.cpp files through the #include name.h ).
It seems like the DLL is not linking the functions from the other .cpp
files in the folder. If i remove everything and just try to make a
dll with 1 of the files (that do not reference any other functions)
like timer.cpp, it will make the timer.dll fine.
Once I try to make a DLL from a file like cls.cpp (which refrences the
timer.h) it fails with the __timer external symbol unresolved.
But it manages to link them all together fine with the Static Library
(.lib) project? How can I get this to compile as a DLL if I wish to?
How do I tell Visual Studio to make the dll with linking to the other
files in the project like the lib does?
I have played around with some of the options in the DLL Properties >
Linker >> (General/Input) tabs... but no success.
Thanks!