I have problem runnig my c++ code in clion, using cmake. This is example code
#include <shlwapi.h>
int main() {
StrDupA(nullptr);
return 0;
}
And there is an exception:
cmd.exe /C "cd . && C:\PROGRA~1\JETBRA~1\CLION2~1.4\bin\mingw\bin\G__~1.EXE -g -static-libgcc -static-libstdc++ -static CMakeFiles/untitled.dir/main.cpp.obj -o untitled.exe -Wl,--out-implib,libuntitled.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:\Program Files\JetBrains\CLion 2022.2.4\bin\mingw\bin/ld.exe: CMakeFiles/untitled.dir/main.cpp.obj:C:/Users/Adm/CLionProjects/untitled/main.cpp:8: undefined reference to `__imp_StrDupA'
CMakeList:
cmake_minimum_required(VERSION 3.23)
project(untitled)
#
set(CMAKE_CXX_STANDARD 11)
add_executable(untitled main.cpp)
It seems like linker doesnt add standard mingw libraries. I have .h files included automatically by clion but there is no source files linked to run code. Do somebody have idea what is going on? How CMakeList look like to include standard libraries. Same situation is with windows libraries from directory C:/Windows/System32/... e.g C:\Windows\System32\nsi.dll