I am having trouble compiling the following code (pathRemove.c). I am compiling with: gcc pathRemove.c -o pathRemove -mno-cygwin #include <windows.h> #include <stdio.h> #include <shlwapi.h> char lpszBinaryPathName[] = {"c:\\temp\\fred.txt"}; int main(int argc, char *argv[]) { printf("before: %s\n",lpszBinaryPathName); PathRemoveFileSpec(lpszBinaryPathName); printf("after: %s\n",lpszBinaryPathName); } The result I get is: $ gcc pathRemove.c -o pathRemove -mno-cygwin /cygdrive/c/DOCUME~1/wallissd/LOCALS~1/Temp/ccOswrXZ.o:pathRemove.c:(.te xt+0x46) : undefined reference to `__imp__PathRemoveFileSpecA@4' collect2: ld returned 1 exit status What am I doing wrong?? Here is the result of a gcc -v pathRemove.c -o pathRemove -mno-cygwin $ gcc -v pathRemove.c -o pathRemove -mno-cygwin Reading specs from /usr/lib/gcc/i686-pc-mingw32/3.4.4/specs Configured with: /gcc/gcc-3.4.4/gcc-3.4.4-1/configure --verbose --prefix=/usr -- exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --man dir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77, java,objc --enable-nls --without-included-gettext --enable-version-specific-runt ime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib --ena ble-interpreter --disable-libgcj-debug --enable-threads=posix --enable-java-gc=b oehm --disable-win32-registry --enable-sjlj-exceptions --enable-hash-synchroniza tion --enable-libstdcxx-debug : (reconfigured) Thread model: posix gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) /usr/lib/gcc/i686-pc-mingw32/3.4.4/cc1.exe -quiet -v -D__MSVCRT__ -D__MINGW32__ -DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -DWINNT -idirafter /usr/lib/gcc/i686-pc- mingw32/3.4.4/../../../../include/w32api -idirafter /usr/lib/gcc/i686-pc-mingw32 /3.4.4/../../../../i686-pc-mingw32/lib/../../include/w32api pathRemove.c -quiet -dumpbase pathRemove.c -mno-cygwin -mtune=pentiumpro -auxbase pathRemove -versio n -o /cygdrive/c/DOCUME~1/wallissd/LOCALS~1/Temp/ccYzr5OA.s ignoring nonexistent directory "/usr/local/include/mingw" ignoring duplicate directory "/usr/include/mingw" ignoring duplicate directory "/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i68 6-pc-mingw32/lib/../../include/w32api" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/i686-pc-cygwin/3.4.4/include /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/include /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api End of search list. GNU C version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) (i686-pc-cygwi n) compiled by GNU C version 3.4.4 (cygming special) (gdc 0.12, using dmd 0 .125). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/bin/as.ex e -o /c ygdrive/c/DOCUME~1/wallissd/LOCALS~1/Temp/ccIZLzrD.o /cygdrive/c/DOCUME~1/wallis sd/LOCALS~1/Temp/ccYzr5OA.s /usr/lib/gcc/i686-pc-mingw32/3.4.4/collect2.exe -Bdynamic -o pathRemove.exe /us r/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/crt2.o -L/usr/li b/gcc/i686-pc-mingw32/3.4.4 -L/usr/lib/gcc/i686-pc-mingw32/3.4.4 -L/usr/lib/gcc/ i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib -L/usr/lib/gcc/i686-pc-min gw32/3.4.4/../../.. /cygdrive/c/DOCUME~1/wallissd/LOCALS~1/Temp/ccIZLzrD.o -lmin gw32 -lgcc -lmoldname -lmingwex -lmsvcrt -lmingw32 -luser32 -lkernel32 -ladvapi3 2 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt /cygdrive/c/DOCUME~1/wallissd/LOCALS~1/Temp/ccIZLzrD.o:pathRemove.c:(.te xt+0x46) : undefined reference to `__imp__PathRemoveFileSpecA@4' collect2: ld returned 1 exit status Darren "This e-mail and any attachments to it (the "Communication") is, unless otherwise stated, confidential, may contain copyright material and is for the use only of the intended recipient. If you receive the Communication in error, please notify the sender immediately by return e-mail, delete the Communication and the return e-mail, and do not read, copy, retransmit or otherwise deal with it. Any views expressed in the Communication are those of the individual sender only, unless expressly stated to be those of Australia and New Zealand Banking Group Limited ABN 11 005 357 522, or any of its related entities including ANZ National Bank Limited (together "ANZ"). ANZ does not accept liability in connection with the integrity of or errors in the Communication, computer virus, data corruption, interference or delay arising from or in respect of the Communication."