Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unresolved External Symbol #45

Closed
ghost opened this issue Aug 21, 2019 · 2 comments
Closed

Unresolved External Symbol #45

ghost opened this issue Aug 21, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Aug 21, 2019

Hello, just real quick thank you for this amazing repository.

I have built PolyHook in x64-Release mode and now I'm attempting to include it into my project, but whenever I attempt to build the project I get this build output:

  ILCallback.cpp
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __cdecl asmjit::BaseCompiler::_newStack(class asmjit::BaseMem &,unsigned int,unsigned int,char const *)" (__imp_?_newStack@BaseCompiler@asmjit@@QEAAIAEAVBaseMem@2@IIPEBD@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __cdecl asmjit::BaseCompiler::_newReg(class asmjit::BaseReg &,unsigned int,char const *)" (__imp_?_newReg@BaseCompiler@asmjit@@QEAAIAEAVBaseReg@2@IPEBD@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __cdecl asmjit::BaseCompiler::_newReg(class asmjit::BaseReg &,unsigned int,char const *,char *)" (__imp_?_newReg@BaseCompiler@asmjit@@QEAAIAEAVBaseReg@2@IPEBDPEAD@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class asmjit::FuncCallNode * __cdecl asmjit::BaseCompiler::addCall(unsigned int,struct asmjit::Operand_ const &,struct asmjit::FuncSignature const &)" (__imp_?addCall@BaseCompiler@asmjit@@QEAAPEAVFuncCallNode@2@IAEBUOperand_@2@AEBUFuncSignature@2@@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class asmjit::FuncRetNode * __cdecl asmjit::BaseCompiler::addRet(struct asmjit::Operand_ const &,struct asmjit::Operand_ const &)" (__imp_?addRet@BaseCompiler@asmjit@@QEAAPEAVFuncRetNode@2@AEBUOperand_@2@0@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __cdecl asmjit::BaseCompiler::setArg(unsigned int,class asmjit::BaseReg const &)" (__imp_?setArg@BaseCompiler@asmjit@@QEAAIIAEBVBaseReg@2@@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __cdecl asmjit::BaseCompiler::endFunc(void)" (__imp_?endFunc@BaseCompiler@asmjit@@QEAAIXZ)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class asmjit::FuncNode * __cdecl asmjit::BaseCompiler::addFunc(struct asmjit::FuncSignature const &)" (__imp_?addFunc@BaseCompiler@asmjit@@QEAAPEAVFuncNode@2@AEBUFuncSignature@2@@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl asmjit::ArchInfo::init(unsigned int,unsigned int)" (__imp_?init@ArchInfo@asmjit@@QEAAXII@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __cdecl asmjit::FuncCallNode::_setArg(unsigned int,struct asmjit::Operand_ const &)" (__imp_?_setArg@FuncCallNode@asmjit@@QEAA_NIAEBUOperand_@2@@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl asmjit::StringLogger::~StringLogger(void)" (__imp_??1StringLogger@asmjit@@UEAA@XZ)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl asmjit::StringLogger::StringLogger(void)" (__imp_??0StringLogger@asmjit@@QEAA@XZ)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl asmjit::x86::Assembler::~Assembler(void)" (__imp_??1Assembler@x86@asmjit@@UEAA@XZ)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl asmjit::x86::Assembler::Assembler(class asmjit::CodeHolder *)" (__imp_??0Assembler@x86@asmjit@@QEAA@PEAVCodeHolder@2@@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl asmjit::x86::Compiler::~Compiler(void)" (__imp_??1Compiler@x86@asmjit@@UEAA@XZ)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl asmjit::x86::Compiler::Compiler(class asmjit::CodeHolder *)" (__imp_??0Compiler@x86@asmjit@@QEAA@PEAVCodeHolder@2@@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __cdecl asmjit::CodeHolder::copyFlattenedData(void *,unsigned __int64,unsigned int)" (__imp_?copyFlattenedData@CodeHolder@asmjit@@QEAAIPEAX_KI@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __cdecl asmjit::CodeHolder::relocateToBase(unsigned __int64)" (__imp_?relocateToBase@CodeHolder@asmjit@@QEAAI_K@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned __int64 __cdecl asmjit::CodeHolder::codeSize(void)const " (__imp_?codeSize@CodeHolder@asmjit@@QEBA_KXZ)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __cdecl asmjit::CodeHolder::flatten(void)" (__imp_?flatten@CodeHolder@asmjit@@QEAAIXZ)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __cdecl asmjit::CodeHolder::resolveUnresolvedLinks(void)" (__imp_?resolveUnresolvedLinks@CodeHolder@asmjit@@QEAAIXZ)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl asmjit::CodeHolder::setLogger(class asmjit::Logger *)" (__imp_?setLogger@CodeHolder@asmjit@@QEAAXPEAVLogger@2@@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __cdecl asmjit::CodeHolder::init(class asmjit::CodeInfo const &)" (__imp_?init@CodeHolder@asmjit@@QEAAIAEBVCodeInfo@2@@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl asmjit::CodeHolder::~CodeHolder(void)" (__imp_??1CodeHolder@asmjit@@QEAA@XZ)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl asmjit::CodeHolder::CodeHolder(void)" (__imp_??0CodeHolder@asmjit@@QEAA@XZ)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __cdecl asmjit::BaseBuilder::serialize(class asmjit::BaseEmitter *)" (__imp_?serialize@BaseBuilder@asmjit@@QEAAIPEAVBaseEmitter@2@@Z)
ILCallback.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: unsigned int __cdecl asmjit::BaseBuilder::runPasses(void)" (__imp_?runPasses@BaseBuilder@asmjit@@QEAAIXZ)
C:\Users\alxbrn\Desktop\plh\x64\Release\plh.dll : fatal error LNK1120: 27 unresolved externals

Aditional Dependencies:
capstone.lib;asmjit.lib;polyhook_2.lib;

Project structure:
image

I believe that I have missed some crucial information about how to use PolyHook correctly, any help is appreciated. (If full project is needed / more information, then please tell me)

@stevemk14ebr
Copy link
Owner

Make sure you have the latest version of visual studio, and that you've got the cmake tools support installed for visual studio. Read about that here: https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=vs-2019

Then you need to import the project as a cmake poject, you will not have to set additional dependencies and things like that, the cmake script will do all that for you. This is all documented clearly in the readme, I suggest giving that another thorough read and starting fresh.

@ghost
Copy link
Author

ghost commented Aug 22, 2019

Thank you, all issues went away as soon as i ported my source to cmake.

@ghost ghost closed this as completed Aug 22, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant