Can you be more specific in how you're linking?
CodeBlocks is an IDE. You can think of it as being a wrapper around a compiler. The default compiler (and linker) that can come bundled with CodeBlocks is g++
(part of GCC).
For linker errors like this, it's important to be very precise in communicating what you've done.
In my mingw directory tree, I have the two files:
Directory of C:\MinGW\x86_64-w64-mingw32\lib
libws2_32.a (174,452 bytes)
libshlwapi.a (274,140 bytes)
With the following code,
bool is_dir = PathIsDirectory("C:\\foo");
std::cout << "is " << ((is_dir) ? "dir" : "not dir");
If I compile with
g++ main.cpp -o main.exe
I get the following error:
C:\code\cplusplus241958>g++ main.cpp -o main.exe
C:\Users\Foo\AppData\Local\Temp\ccNDV47z.o:main.cpp:(.text+0x17): undefined reference to `__imp_PathIsDirectoryA'
collect2.exe: error: ld returned 1 exit status
To alleviate this, I need to explicitly link with the libshlwapi.a, like you said.
I did this through:
g++ main.cpp -lshlwapi -o main.exe
g++ main.cpp -o main.exe -lshlwapi
And no longer get linker errors.
I can't use CB right now, but if you go to your project settings somewhere, you should be able to specify -lshlwapi as an additional linker command or command-line argument.
(CodeBlocks might add the dash or the lowercase-L for you, I'm not sure. Try different combos.)
If that doesn't work, post the XML of your .cbp file.