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

Undefined reference to `__imp_GetUserProfileDirectoryW' #16

Open
heckad opened this issue Sep 16, 2020 · 2 comments
Open

Undefined reference to `__imp_GetUserProfileDirectoryW' #16

heckad opened this issue Sep 16, 2020 · 2 comments

Comments

@heckad
Copy link

heckad commented Sep 16, 2020

Build command:
cmake.exe --build C:\Users\Asus\Documents\Projects\cpp\CppTrader\cmake-build-debug --target cpptrader-tests -- -j 9

Output error

modules/CppCommon/libcppcommon.a(path.cpp.obj): In function `CppCommon::Path::home()':
C:/Users/Asus/Documents/Projects/cpp/CppTrader/modules/CppCommon/source/filesystem/path.cpp:970: undefined reference to `__imp_GetUserProfileDirectoryW'
C:/Users/Asus/Documents/Projects/cpp/CppTrader/modules/CppCommon/source/filesystem/path.cpp:973: undefined reference to `__imp_GetUserProfileDirectoryW'
modules/CppCommon/libcppcommon.a(uuid.cpp.obj): In function `CppCommon::UUID::Sequential()':
C:/Users/Asus/Documents/Projects/cpp/CppTrader/modules/CppCommon/source/system/uuid.cpp:123: undefined reference to `__imp_UuidCreateSequential'
modules/CppCommon/libcppcommon.a(uuid.cpp.obj): In function `CppCommon::UUID::Random()':
C:/Users/Asus/Documents/Projects/cpp/CppTrader/modules/CppCommon/source/system/uuid.cpp:179: undefined reference to `__imp_UuidCreate'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [CMakeFiles\cpptrader-tests.dir\build.make:158: cpptrader-tests.exe] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:498: CMakeFiles/cpptrader-tests.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:505: CMakeFiles/cpptrader-tests.dir/rule] Error 2

Cmake output:

-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/gcc.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/g++.exe
-- Check for working CXX compiler: C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/g++.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- The System identification is Windows-10.0.19041 Windows 10.0.19041 Platform/Windows
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- The System identification is Windows-10.0.19041 Windows 10.0.19041 Platform/Windows
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- The System identification is Windows-10.0.19041 Windows 10.0.19041 Platform/Windows
-- Could NOT find DbgHelp (missing: DBGHELP_LIBRARY DBGHELP_INCLUDE_DIR) 
-- Could NOT find RPC (missing: RPC_LIBRARY RPC_INCLUDE_DIR) 
-- Could NOT find Userenv (missing: USERENV_LIBRARY USERENV_INCLUDE_DIR) 
-- Found LIBVLD: C:/Users/Asus/Documents/Projects/cpp/CppTrader/modules/CppCommon/modules/vld/vld.lib  
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Asus/Documents/Projects/cpp/CppTrader/cmake-build-debug
@chronoxor
Copy link
Owner

You need to have Win32 API includes and libs available for MinGW:

INCLUDE: C:\mingw64\x86_64-w64-mingw32\include
LIB: C:\mingw64\x86_64-w64-mingw32\lib

@chronoxor
Copy link
Owner

Please check if you have the following in build logs:

-- Found DbgHelp: C:/mingw64/x86_64-w64-mingw32/lib/libdbghelp.a  
-- Found RPC: C:/mingw64/x86_64-w64-mingw32/lib/librpcrt4.a  
-- Found Userenv: C:/mingw64/x86_64-w64-mingw32/lib/libuserenv.a  

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

2 participants