LNK2019: unresolved external
-
int _tmain() { LPCTSTR strName("HideDriver.sys"); utils::DriverWork::Start(strName); return 0; } /*this code causes error LNK2019: unresolved external symbol "public: static void __cdecl utils::DriverWork::Start(char const *)" (?Start@DriverWork@utils@@SAXPBD@Z) referenced in function _main */ it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,???
-
int _tmain() { LPCTSTR strName("HideDriver.sys"); utils::DriverWork::Start(strName); return 0; } /*this code causes error LNK2019: unresolved external symbol "public: static void __cdecl utils::DriverWork::Start(char const *)" (?Start@DriverWork@utils@@SAXPBD@Z) referenced in function _main */ it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,???
af00001 wrote:
it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,???
The
.h
files do not get actioned by the build system or compiler, only insofar as they are included into the source via the.cpp
files. The compiler will only get executed to convert a.cpp
file (and its inclusions) into object code.Veni, vidi, abiit domum
-
int _tmain() { LPCTSTR strName("HideDriver.sys"); utils::DriverWork::Start(strName); return 0; } /*this code causes error LNK2019: unresolved external symbol "public: static void __cdecl utils::DriverWork::Start(char const *)" (?Start@DriverWork@utils@@SAXPBD@Z) referenced in function _main */ it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,???
-
This looks more like unmanaged C++ than managed. You need to include the .lib file of the dll the function resides in into the linker input of your application.
The good thing about pessimism is, that you are always either right or pleasently surprised.
-
This looks more like unmanaged C++ than managed. You need to include the .lib file of the dll the function resides in into the linker input of your application.
The good thing about pessimism is, that you are always either right or pleasently surprised.
-
Freak30 wrote:
This looks more like unmanaged C++ than managed.
Not at all. The key is that the code is contained within the header file, so why is the .cpp file necessary. That's the way C++/CLI is done.
Veni, vidi, abiit domum
-
af00001 wrote:
it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,???
The
.h
files do not get actioned by the build system or compiler, only insofar as they are included into the source via the.cpp
files. The compiler will only get executed to convert a.cpp
file (and its inclusions) into object code.Veni, vidi, abiit domum
-
int _tmain() { LPCTSTR strName("HideDriver.sys"); utils::DriverWork::Start(strName); return 0; } /*this code causes error LNK2019: unresolved external symbol "public: static void __cdecl utils::DriverWork::Start(char const *)" (?Start@DriverWork@utils@@SAXPBD@Z) referenced in function _main */ it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,???
Well, did you add DriverWork.cpp to your solution? Well, I was experienced problem like you. Cause of error is that I include header file using #include keyword but know added header and source file to my solutions. Whenever I've added it to my solutions, error disappeared. :cool:
-
Well, did you add DriverWork.cpp to your solution? Well, I was experienced problem like you. Cause of error is that I include header file using #include keyword but know added header and source file to my solutions. Whenever I've added it to my solutions, error disappeared. :cool: