Undefiniertes Symbol in Visual Studio 2022 clang-clC++

Programme in C++. Entwicklerforum
Anonymous
 Undefiniertes Symbol in Visual Studio 2022 clang-cl

Post by Anonymous »

Ich versuche, eine Intel Pin-Funktion in Visual Studio 2022 im clang-cl-Compiler zu kompilieren.
Ich kompiliere sie mit clang-cl, da der neue Pin 4 nur eine clang-kompilierte Version hat.

Code: Select all

VOID  Image(IMG img, VOID *v){
char    szFilePath[260];
unsigned long index;

PIN_GetLock(&lock, 1);
if (process_start != 0){
PIN_ReleaseLock(&lock);
return;
}
if (IMG_Valid(img)){
memset(szFilePath, 0, sizeof(szFilePath));
strncpy(szFilePath, IMG_Name(img).c_str(), sizeof(szFilePath)-1);
index = 0;
while (szFilePath[index] != 0){
szFilePath[index] = tolower(szFilePath[index]);
index++;
}

if (strstr(szFilePath, KnobProcessToTrace.Value().c_str())){
process_start = IMG_LowAddress(img);
process_end   = IMG_HighAddress(img);
}
}
PIN_ReleaseLock(&lock);

}
Dies ist der Befehl des Linkers:

Code: Select all

/OUT:"D:\PinTrace\x64\Release\PinTrace.dll" /MANIFEST:NO /NXCOMPAT /PDB:"D:\PinTrace-src\PinTrace\x64\Release\PinTrace.pdb" /DYNAMICBASE "pin.lib" "libxed.lib" "pinos.lib" "pincrt.lib" "c++.lib" "pincrt4.lib" "rscproto.lib" "pinrt-adaptor-static.lib" "stdlib_new_delete.obj" "compiler-rt.lib" "crtbeginS.obj" /IMPLIB:"D:\PinTrace\x64\Release\PinTrace.lib" /DEBUG /DLL /BASE:"0x55000000" /ENTRY:"Ptrace_DllMainCRTStartup@12" /OPT:REF /INCREMENTAL:NO /PGD:"D:\PinTrace-src\PinTrace\x64\Release\PinTrace.pgd" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"PinTrace\x64\Release\PinTrace.dll.intermediate.manifest" /NODEFAULTLIB
Und die Fehler:

Code: Select all

lld-link : error : : undefined symbol: Ptrace_DllMainCRTStartup@12
lld-link : error : undefined symbol: class std::basic_string const & __cdecl LEVEL_PINCLIENT::IMG_Name(class LEVEL_CORE::INDEX)
1>>>> referenced by PinTrace\x64\Release\main.obj:(void __cdecl Image(class LEVEL_CORE::INDEX, void *))
1>>>> referenced by PinTrace\x64\Release\main.obj:(void __cdecl ImageUnload(class LEVEL_CORE::INDEX, void *))
1>
1>lld-link : error : undefined symbol: unsigned int __cdecl LEVEL_PINCLIENT::IMG_LowAddress(class LEVEL_CORE::INDEX)
1>>>> referenced by PinTrace\x64\Release\main.obj:(void __cdecl Image(class LEVEL_CORE::INDEX, void *))
1>
1>lld-link : error : undefined symbol: unsigned int __cdecl LEVEL_PINCLIENT::IMG_HighAddress(class LEVEL_CORE::INDEX)
1>>>> referenced by PinTrace\x64\Release\main.obj:(void __cdecl Image(class LEVEL_CORE::INDEX, void *))
1>
1>lld-link : error : undefined symbol: unsigned int __cdecl LEVEL_PINCLIENT::TRACE_Address(class LEVEL_PINCLIENT::TRACE_CLASS *)
1>>>> referenced by PinTrace\x64\Release\main.obj:(void __cdecl Trace(class LEVEL_PINCLIENT::TRACE_CLASS *, void *))
1>
1>lld-link : error : undefined symbol: class LEVEL_PINCLIENT::COMPLEX_CALLBACKVAL_BASE * __cdecl LEVEL_PINCLIENT::PIN_AddContextChangeFunction(void (__cdecl *)(int, enum LEVEL_VM::CONTEXT_CHANGE_REASON, struct LEVEL_VM::CONTEXT const *, struct LEVEL_VM::CONTEXT *, int, void *), void *)
1>>>> referenced by PinTrace\x64\Release\main.obj:(main)
Diese Funktionen sind in pin.lib definiert, aber der Compiler findet sie dort nicht.
In der image.ph-Datei ist IMG_Name definiert als:

Code: Select all

const std::string& IMG_Name(IMG img);
aber der Compiler sucht es in pin.lib als:

Code: Select all

class std::basic_string const & __cdecl LEVEL_PINCLIENT::IMG_Name(class LEVEL_CORE::INDEX)
Ist das der Grund, warum es dort nicht gefunden wird? Gibt es eine Möglichkeit, dies zu beheben?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post