1. ## Linking to shlwapi.lib in C, MSVC CMD.

Hi, I have a C code that uses some of the exports of shlwapi.dll and I'm trying to compile it using Visual Studio 2008 and the Vista SDK.

The problem is that when I compile it as C code I can't link to shlwapi.lib. I get the following error:

Code:
```inicontrol.c
shlwapi.lib
c1 : fatal error C1083: Cannot open source file: 'shlwapi.lib': No such file or directory
Generating Code...```
The command line to that is: cl /O1 /TC inicontrol.c shlwapi.lib

Anyone knows if it's possible to compile it as C code and link to that library?

P.S.: Linking as C++ code works well. Pointing to shlwapi.lib directly outputs loads of errors.

2. Did you add the path properly in your VS settings? You should have "/LIBPATH:some_path" where some_path is the path to the .lib file.

3. Yes. Somewhat if it is compiled as C++ code it compiles just fine, but if it's compiled as C code the linker complains about finding the file.

I've tried to point it to shlwapi.lib using the full path of to it, and it shows lots of errors:

Code:
```inicontrol.c
shlwapi.lib
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(1) : error C2059:
syntax error : '!'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(2) : error C2018:
unknown character '0x60'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(3) : error C2018:
unknown character '0x2'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(3) : error C2018:
unknown character '0x14'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(3) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(3) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(3) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(3) : error C2018:
unknown character '0xe'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(3) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(3) : error C2018:
unknown character '0xe'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(3) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(3) : error C2018:
unknown character '0xe'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(4) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(4) : error C2018:
unknown character '0xe'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C3872:
'0xa0': this character is not allowed in an identifier
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C3872:
'0xa0': this character is not allowed in an identifier
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1c'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1c'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1d'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1d'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x11'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x11'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x14'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x40'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x14'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x40'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x12'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x12'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x13'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x13'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(5) : error C2014:
preprocessor command must start as first nonwhite space
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(6) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1c'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1c'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1d'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1d'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1e'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0xe'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1e'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0xe'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1e'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1e'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1b'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1b'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1b'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1b'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x8'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x8'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C2018:
unknown character '0x1'
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : error C3872:
'0x24': this character is not allowed in an identifier
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\shlwapi.lib(7) : fatal error C
1003: error count exceeds 100; stopping compilation
Generating Code...```

4. Unless I'm mistaken, it looks like you are trying to compile the .lib file instead of linking to it.

5. Yes! That was the problem, I forgot the /link parameter.