VS2010 Many errors when including standard libraries

When I include the standard library in my VS2010 project, I get TON of such errors (these errors were related to adding to shellapi.h ). I get similar errors when adding something like Windows.h or Wininet.h or something like that.

1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(56): error C2065: 'HDROP' : undeclared identifier 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(56): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C2144: syntax error : 'int' should be preceded by ';' 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C2146: syntax error : missing ';' before identifier 'STDAPICALLTYPE' 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C2146: syntax error : missing ';' before identifier 'DragQueryFileA' 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C2065: 'HDROP' : undeclared identifier 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C2146: syntax error : missing ')' before identifier 'hDrop' 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C2059: syntax error : ')' 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(61): error C2144: syntax error : 'int' should be preceded by ';' 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(61): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(61): error C2086: 'int EXTERN_C' : redefinition 

I am sure that this is just what is involved in setting up the project, but I have no idea which setting I need to change. Where to begin?

UPDATE

The solution was to download the windows.h download first. I did not know that it depended on this. For future reference, where should I have looked at this addiction?

+4
source share
2 answers

This happens when one of your inclusions is broken, then you include the standard header, because your syntax error continues directly. For example, if you forgot the gender, then include a different heading, this heading will report syntax errors. For this reason, you should always include clean headers, such as system headers, and then your own headers.

+2
source

I got these exact errors when adding

 #include <shellapi.h> 

to one of my files. I solved the problem by adding

 #include <windows.h> 

just before that.

(You need to love - or rather, hate - Windows headers that don't have #include headers that they themselves require. If I did this in my own code, I would scream my superiors!)

+5
source

Source: https://habr.com/ru/post/1311561/


All Articles