NodeJS Windows node-gyp build fails - windows

Anything I try to npm install on windows that requires node-gyp explodes in errors. I tried reinstalling all the windows stuff suggested on the node-gyp github page.
Why am I getting these errors? This is an attempt to install mongodb
PS C:\Users\Farzher\Documents\Dev\nodejs\abc> npm install mongodb
npm WARN package.json prelude-ls-extended#0.0.0 No description
npm http GET https://registry.npmjs.org/mongodb
npm http 304 https://registry.npmjs.org/mongodb
npm http GET https://registry.npmjs.org/bson/0.2.5
npm http GET https://registry.npmjs.org/kerberos/0.0.3
npm http 304 https://registry.npmjs.org/bson/0.2.5
npm http 304 https://registry.npmjs.org/kerberos/0.0.3
> kerberos#0.0.3 install C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)
C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos>node "c:\Program Files\nodejs\node_modules\npm\bin\node-gyp-
bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
kerberos.cc
worker.cc
security_credentials.cc
security_buffer.cc
security_buffer_descriptor.cc
security_context.cc
c:\users\farzher\node_modules\mongodb\node_modules\kerberos\lib\win32\worker.h(17): error C2146: syntax error : missing
';' before identifier 'request' [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
c:\users\farzher\node_modules\mongodb\node_modules\kerberos\lib\win32\worker.h(17): error C4430: missing type specifier
- int assumed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\bui
ld\kerberos.vcxproj]
c:\users\farzher\node_modules\mongodb\node_modules\kerberos\lib\win32\worker.h(17): error C4430: missing type specifier
- int assumed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\bui
ld\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used,
but unwind semantics are not enabled. Specify /EHsc [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build
\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used,
but unwind semantics are not enabled. Specify /EHsc [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build
\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used,
but unwind semantics are not enabled. Specify /EHsc [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build
\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used,
but unwind semantics are not enabled. Specify /EHsc [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build
\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(82): error C2146: syntax error : missing ';' before
identifier 'SEC_WCHAR' [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(82): error C4430: missing type specifier - int assum
ed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.
vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(82): error C4430: missing type specifier - int assum
ed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.
vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(83): error C2146: syntax error : missing ';' before
identifier 'SEC_CHAR' [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(83): error C4430: missing type specifier - int assum
ed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.
vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(83): error C4430: missing type specifier - int assum
ed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.
vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(86): error C2146: syntax error : missing ';' before
identifier 'SECURITY_STATUS' [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(86): error C4430: missing type specifier - int assum
ed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.
vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(86): error C4430: missing type specifier - int assum
ed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.
vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(105): error C2143: syntax error : missing ';' before
'*' [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(105): error C4430: missing type specifier - int assu
med. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos
.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(105): error C2378: 'SEC_CHAR' : redefinition; symbol
cannot be overloaded with a typedef [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.vcxpro

You need Python on your machine for gyp to work, AFAIK.

Related

Matlab mex command for building armaMex_demo.cpp in Armadillo in Windows

I am having troubles mex-ing armaMex_demo_cpp in Armadillo (armadillo-8.500.1) in Windows with Matlab (2018a).
So far I am trying the command:
>> mex -LC:\Users\Test\Documents\Armadillo\armadillo-8.500.1-mod_for_windows\include\armadillo -LC:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin\gfortran -IC:\Users\Test\Documents\Armadillo\armadillo-8.500.1-mod_for_windows\include armaMex_demo.cpp
and get the error messages (truncated):
Building with 'Microsoft Visual C++ 2017'.
Error using mex
armaMex_demo.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\random(31): error C4430: missing type specifier - int
assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\random(31): error C2146: syntax error: missing ';' before
identifier 'ARMA_USE_BLAS'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\random(31): error C2143: syntax error: missing ';' before
'{'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\random(31): error C2447: '{': missing function header
(old-style formal list?)
c:\users\test\documents\armadillo\armadillo-8.500.1-mod_for_windows\include\armadillo_bits/arma_rng_cxx11.hpp(28): error C2039: 'mt19937_64': is not a
member of 'std'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\atomic(42): note: see declaration of 'std'
c:\users\test\documents\armadillo\armadillo-8.500.1-mod_for_windows\include\armadillo_bits/arma_rng_cxx11.hpp(28): error C3083: 'mt19937_64': the symbol
to the left of a '::' must be a type
c:\users\test\documents\armadillo\armadillo-8.500.1-mod_for_windows\include\armadillo_bits/arma_rng_cxx11.hpp(28): error C2039: 'result_type': is not a
member of 'std'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\atomic(42): note: see declaration of 'std'
c:\users\test\documents\armadillo\armadillo-8.500.1-mod_for_windows\include\armadillo_bits/arma_rng_cxx11.hpp(28): error C3646: 'seed_type': unknown
override specifier
Does any one have any ideas of what I may be doing wrong here?
Anybody have a working mex command for building the mex file for armaMex_demo.cpp in Windows?
Seems to have something to do with how I am including/referencing to BLAS. I used to have the line '#define ARMA_USE_BLAS' uncommented in config.hpp. By leaving it commented I, with this mex command:
mex -LC:\Users\Test\Documents\Armadillo\armadillo-8.500.1-mod_for_windows\include\armadillo -LC:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin\gfortran -IC:\Users\Test\Documents\Armadillo\armadillo-8.500.1-mod_for_windows\include armaMex_demo.cpp
I only get this error:
Building with 'Microsoft Visual C++ 2017'.
Error using mex
armaMex_demo.cpp
C:\Users\Test\Documents\Armadillo\armadillo-8.500.1-mod_for_windows\mex_interface\armaMex_demo.cpp(44): error C2668: 'arma::size': ambiguous call to
overloaded function
c:\users\test\documents\armadillo\armadillo-8.500.1-mod_for_windows\include\armadillo_bits/fn_size.hpp(38): note: could be 'const
arma::SizeMat
arma::size(const T1 &)'
with
[
T1=arma::mat
]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\xutility(1654): note: or 'arma::uword
std::size(const _Container &)'
with
[
_Container=arma::mat
]
C:\Users\Test\Documents\Armadillo\armadillo-8.500.1-mod_for_windows\mex_interface\armaMex_demo.cpp(44): note: while trying to match the argument list
'(arma::mat)'
And by changing the line
if ( size(X) != size(Y) )
to
if ( X.size() != Y.size() )
in armaMex_demo.cpp
the mexing (and the mex call) works in Windows from Matlab.

Unable to build - Migrating VC++ code from VS2010 to VS2013

I am trying to migrate my source from VS2010 to VS2013. It is giving me sleepless nights. I'm getting the below attached compilation error. Please help me out in identifying which compilation switch I'm missing out. I have saved my .sln file from VS2013 to get it adapted to the new environment.
My current compilation settings are as follows:
PlatformToolset: Visual Studio 2013 - Windows XP (v120_xp)
Command Line:
/Yu"stdafx.h" /FR"DebugU\" /GS /TP /analyze- /W3 /Zc:wchar_t /I"..\Common" /Zi /Gm- /Od /Fd".\DebugU/" /fp:precise /D "_PUGIXML" /D "_DEBUG" /D "_USRDLL" /D "_CRT_SECURE_NO_WARNINGS" /D "_BIND_TO_CURRENT_VCLIBS_VERSION" /D "_VC80_UPGRADE=0x0700" /D "_USING_V110_SDK71_" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX /Zc:forScope /RTC1 /Gd /Oy- /showIncludes /MTd /Fa".\DebugU/" /EHsc /nologo /Fo".\DebugU/" /Fp".\DebugU/xxxxxxxx.pch"
Compilation Log with "ShowIncludes"
1> pugixml.cpp
1> Note: including file: d:\vistasonicpoc\common\pugixml.hpp
1> Note: including file: d:\vistasonicpoc\common\pugiconfig.hpp
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\exception
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\cstddef
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\yvals.h
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xkeycheck.h
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\crtdefs.h
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\use_ansi.h
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\initializer_list
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xtr1common
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xtr1common(421): error C2159: more than one storage class specified
1> C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xtr1common(421) : see reference to class template instantiation 'std::_Has_result_type<_Ty>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xtr1common(421): error C3557: a function cannot have both a return type and a late-specified return type
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xtr1common(421): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(203): error C3557: a function cannot have both a return type and a late-specified return type
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(203): warning C4042: 'std::plus<void>::operator ()' : has bad storage class
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(203): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(218): error C3557: a function cannot have both a return type and a late-specified return type
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(218): warning C4042: 'std::minus<void>::operator ()' : has bad storage class
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(218): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(233): error C3557: a function cannot have both a return type and a late-specified return type
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(233): warning C4042: 'std::multiplies<void>::operator ()' : has bad storage class
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(233): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(248): error C3557: a function cannot have both a return type and a late-specified return type
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(248): warning C4042: 'std::equal_to<void>::operator ()' : has bad storage class
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(248): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(263): error C3557: a function cannot have both a return type and a late-specified return type
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(263): warning C4042: 'std::less<void>::operator ()' : has bad storage class
1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xstddef(263): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
I had the same problem and found out that the flag /Zc:auto was set to /Zc:auto- and this was causing all the errors.
You don't seem to have it specified in the command line but it could help someone else having the same type of error.
Zc:auto

Connecting DB2 from Node.js on Windows-platform

I am currently mirroring the DB2 to local MySQL-db with some jdbc-code. I would like to connect DB2 directly from Node.js app without having to query the mirror. I am running on Windows and I cannot change to Linux. It seems that work on DB2 with Node.js is yet very marginal or node-odbc is used (unixODBC bindings for node).
I found this project https://github.com/herzi/db2.js which provides DB2-bindings for Node but I cannot install it as the install fails. The package requires Node-gyp (installed this successfully) and .NET framework SDK. I set the vcbuild.exe into my PATH. After these the msbuild.exe complained about missing header files (sqlcli1.h, sqlsystm.h, sqlca.h), which I found out are part of PRO*C.
I took the header files above from here: http://files.edin.dk/php/win32/dev/php_build/include/db2/ and put them into my Node's src/ directory. Now the compiler shows multiple errors.
Are there any other options when working with Windows to connect DB2 from Node.js app than try to get the above module to work?
Anyone able to help me out here? What are the steps to get the above module installed?
Thanks!
Errors shown:
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C2146 : syntax error : missing ';' before identifier 'SQLSTATE' [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C2146: syntax error : missing ';' before identifier 'SQLSTATE' [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Documents and Settings\tpaleniu\.node-gyp\0.8.12\src\sqlcli1.h(1501): error C2371: 'SQLTCHAR' : redefinition; different basic types [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30) : see declaration of 'SQLTCHAR'
..\src\connection.cc(77): error C3861: 'snprintf': identifier not found
[C:\IS\node\node_modules\db2\build\db2.vcxproj]..\src\connection.cc(80): error C3861: 'snprintf': identifier not found [C:\IS\node\node_modules\db2\build\db2.vcxproj]
..\src\connection.cc(111): error C3861: 'bzero': identifier not found [C:\IS\node\node_modules\db2\build\db2.vcxproj]
..\src\connection.cc(208): error C3861: 'bzero': identifier not found [C:\IS\node\node_modules\db2\build\db2.vcxproj]
..\src\connection.cc(547): error C2057: expected constant expression [C:\IS\node\node_modules\db2\build\db2.vcxproj]
..\src\connection.cc(547): error C2466: cannot allocate an array of constant size 0 [C:\IS\node\node_modules\db2\build\db2.vcxproj]
..\src\connection.cc(547): error C2133: 'argv' : unknown size [C:\IS\node\node_modules\db2\build\db2.vcxproj]
It is true that node-odbc currently is currently meant only for use with unixODBC. But Daniel VerWeire is currently working on supporting node-odbc on Windows. I guess you need to wait a little while.
Praveen will have a post on it here as soon as it is available

How to include a .h file correctly in VC++?

I have a very simple C++/CLI window form program which is 100% working alright.
Since I want to add call internet explorer when I click a button on my window form, I add "ONE LINE of code" for testing purpose.
I add #include "Shellapi.h" under #pragma once. After that, VS gives me 500 lines of an error message.
My question is that I am only adding a .h file into my program. Why there will cause any problem? Do I miss something?
===========The first few lines of the error message===============
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\Shellapi.h(56): error C2065: 'HDROP' : undeclared identifier
1>C:\Program Files\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\Microsoft SDKs\Windows\v7.0A\include\Shellapi.h(59): error C2146: syntax error : missing ';' before identifier 'DECLSPEC_IMPORT'
1>C:\Program Files\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\Microsoft SDKs\Windows\v7.0A\include\Shellapi.h(59): error C2146: syntax error : missing ';' before identifier 'UINT'
1>C:\Program Files\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\Microsoft SDKs\Windows\v7.0A\include\Shellapi.h(59): error C2146: syntax error : missing ';' before identifier 'STDAPICALLTYPE'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\Shellapi.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Several things:
You should #include <windows.h> in any windows program
You should include any system file - like shellapi.h - using brackets (<>) instead of quotes (""), e.g. #include <shellapi.h>
If you're compiling from the command line, it's a good idea to run "vcvars32.bat" (or equivalent) to set your command-line environment for Visual Studio.
I believe you forgot to #include <windows.h> before #include <shellapi.h>
Generally, (or atleast in my personal experiences), when you are bombarded with a wall of errors after including a header, your missing <windows.h> or some other header.

VS2010 Lots of errors when including standard libraries

When I include a standard library into my VS2010 project, I get a TON of errors like these (these errors were from adding in shellapi.h). I get similar errors when adding in something like Windows.h or Wininet.h or anything 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'm sure this is just something to do with a project setting, but I have no idea what setting I need to change. Where should I begin?
UPDATE
The solution was to make sure that windows.h was loaded first. I did not know it was dependent on that. For future reference, where should I have looked to see that dependency?
I got these exact same errors when adding
#include <shellapi.h>
to one of my files. I solved the problem by adding
#include <windows.h>
directly before it.
(You've got to love - or rather, hate - Windows headers that don't #include the headers that they themselves require. If I did that in my own code I'd get yelled at by my superiors!)
This happens when one of your includes is broken, then you include a standard header, because your syntax error directly carries on. For example, if you forget a semi, then include another header, that header will report syntax errors. For this reason, you should always include "clean" headers like system headers first, then own-defined headers.

Resources