Reputation: 1
Good Afternoon, so I have a question about including the aux_klib library in my Kernel Mode Driver, for some reason I get the same error for all aux_klib functions.
Error 1 error LNK2019: unresolved external symbol AuxKlibInitialize referenced in function "unsigned char __cdecl Main(struct MainInfo*)" (?MainInfo@@YAEPEAU__MainInfo@@@Z)
I did #pragma comment(lib, "aux_klib.lib") in my project and no luck, also the driver is coded in cpp. I also added the lib to my project and made sure it was x64 as that is the projects build architecture. I also tried including the function via extern "C" with out the header and just the lib but no luck, I also added all the library paths to the linker settings and what not. Any ideas are welcome!
Upvotes: 0
Views: 731
Reputation: 21
Properties->Linker->Input->Additional Dependencies add "AUX_KLIB.LIB"
This worked for me
Upvotes: 2
Reputation: 345
I had the same problem with linking Aux_klib.lib
, so I set /VERBOSE:Lib
.
Right click on the project -> Properties -> Linker -> General -> Show Progress
As I understand it, For Libraries Searched /VERBOSE:Lib
shows the libraries search and I've noticed that Aux_klib.lib
is not in that search.
And I noticed another thing in the output, /NODEFAULTLIB
is passed in the command line as well.
As @RbMm says,
are he search for aux_klib.lib may be you used /nodefaultlib option. in this case #pragma comment(lib, "aux_klib.lib") will be have no effect.
So I changed Ignore All Default Libraries
Right click on the project -> Properties -> Linker -> Input -> Ignore All Default Libraries
to No
and everything linked and compiled perfectly.
In short, try to change Ignore All Default Libraries
under Linker
to No
and use #pragma comment(lib, "aux_klib.lib")
.
Upvotes: 0