Click here to Skip to main content
16,004,507 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to add KeyAuth to a C++ Project from me. The Problem is I am trying since Yesterday to solve this Problem:

C++
Schweregrad	Code	Beschreibung	Projekt	Datei	Zeile	Unterdrückungszustand	Details
Fehler	LNK2001	Nicht aufgelöstes externes Symbol ""public: void __cdecl KeyAuth::api::regstr(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?regstr@api@KeyAuth@@QEAAXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z)".	usermode	C:\Users\timog\Documents\Platform\Git Repo\league-unique-main\Apex\usermode\main.obj	1		


Does anyone can Help?

What I have tried:

I declared and defined everything needed (2 Libs) I also add them to the compiler and the linker. SubSystem is Console that is correct.
Additional Library directories are set also additional dependencies.
Additional Includes too.
Posted
Updated 5-Aug-24 3:55am
v2
Comments
RedDk 5-Aug-24 13:34pm    
See my comment here: https://www.codeproject.com/Questions/5385953/How-do-I-resolve-the-following-link-errors-while-t?cmt=1127639#cmt1127639 ... it addresses your problem as well and could, if you read it carefully end the misery you will encounter, as noted below here in your "Solution", commenting functionality. But I must admit, commenting functionality is a step forward in the debugging process ... carry on.

Quote:
I declared and defined everything needed (2 Libs) I also add them to the compiler and the linker.
Well, the linker disagrees with you! :D

If you google the error message, you get here: Linker Tools Error LNK2001 | Microsoft Learn[^] which states that
Quote:
The compiled code makes a reference or call to symbol. The symbol isn't defined in any libraries or object files searched by the linker.

This error message is followed by fatal error LNK1120. To fix error LNK1120, first fix all LNK2001 and LNK2019 errors.

There are many ways to get LNK2001 errors. All of them involve a reference to a function or variable that the linker can't resolve, or find a definition for. The compiler can identify when your code doesn't declare a symbol, but not when it doesn't define one. That's because the definition may be in a different source file or library. If your code refers to a symbol, but it's never defined, the linker generates an error.

We can't help you fix that, you need to check the KeyAuth library (which appears to most likely be a github thing) and see exactly what it provides or contact the author directly and ask them.
 
Share this answer
 
You have not shown the code you are using, or whether this is x86 or x64. But if it is x86, then you are missing a parameter from the KeyAuth::api::regstr function call as shown at KeyAuth-CPP-Example/x86/lib/auth.cpp at main · KeyAuth/KeyAuth-CPP-Example · GitHub[^].
 
Share this answer
 
I found a Workaround. I work on a x64 Architecture
The issue was on this line

C++
KeyAuthApp.regstr(username, password, key);


So I commented it out and don't use it.

But now I face a new Problem I try to solve
can I post it here in this thread or should I start a new one?
 
Share this answer
 
v2
Comments
CHill60 5-Aug-24 10:32am    
Start a new question - you can include a link back to this one if it is relevant

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900