rdbo / libmem

Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)
GNU Affero General Public License v3.0
797 stars 96 forks source link

Rust fails to build on Windows. #233

Closed asss-whom closed 3 months ago

asss-whom commented 3 months ago

What's the problem?

When I try to compile my program with libmem, cargo tells me that the compilation failed:

Creating library C:\<my_program_dir>\target\release\deps\cetutorial.lib and object C:\<my_program_dir>\target\release\deps\cetutorial.exp
          LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
          libmem.lib(Path.cpp.obj) : error LNK2019: unresolved external symbol SHGetKnownFolderPath referenced in function "bool __cdecl llvm_ks::sys::path::getUserCacheDir(class llvm_ks::SmallVectorImpl<char> &)" (?getUserCacheDir@path@sys@llvm_ks@@YA_NAEAV?$SmallVectorImpl@D@3@@Z)
          C:\<my_program_dir>\target\release\deps\cetutorial.exe : fatal error LNK1120: 1 unresolved externals

Do you have a good solution for this please?

My information

My OS version: Windows 11 Home Edition 23H2

My computer: HP ENVY Laptop

My Rust version:rustc 1.79.0 (129f3b996 2024-06-10)

My Rustup version: rustup 1.27.1 (54dd3d00f 2024-04-24)

libmem version: libmem = "5.0.0"

using MSVC toolchain

asss-whom commented 3 months ago

Maybe this problem is caused by different LLVM and WinSDK version in my PC. Now I use libmem = { version = "5.0.0", default-features = false } and download libmem-5.0.0-x86_64-windows-msvc-shared-md, everything goes well.