Visual Studio 2010 and windows SDK 7.0a compilation error - c++

I am new to windows development world. I am having Visual Studio 2010 and windows SDK 7.0a installed on my machine. Any win32 application (even the skeleton generated using the wizard) is giving me this compilation error repeated hundreds of times:
2> Note: including file: C:\Program Files\Microsoft Visual Studio 10.0\VC\include\stdio.h
2> Note: including file: C:\Program Files\Microsoft Visual Studio 10.0\VC\include\crtdefs.h
2> Note: including file: C:\Program Files\Microsoft Visual Studio 10.0\VC\include\swprintf.inl
2> Note: including file: C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\Windows.h
2> Note: including file: C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sdkddkver.h
2> Note: including file: C:\Program Files\Microsoft Visual Studio 10.0\VC\include\excpt.h
2> Note: including file: C:\Program Files\Microsoft Visual Studio 10.0\VC\include\crtdefs.h
2> Note: including file: C:\Program Files\Microsoft Visual Studio 10.0\VC\include\stdarg.h
2> Note: including file: C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\windef.h
2> Note: including file: C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h
2> Note: including file: C:\Program Files\Microsoft Visual Studio 10.0\VC\include\ctype.h
2> Note: including file: C:\Program Files\Microsoft Visual Studio 10.0\VC\include\crtdefs.h
2> Note: including file: C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\specstrings.h
*2> Note: including file: c:\program files\microsoft sdks\windows\v7.0a\include\sal_supp.h*
*2> Note: including file: c:\program files\microsoft sdks\windows\v7.0a\include\specstrings_supp.h*
*2> Note: including file: C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\specstrings_strict.h*
*2> Note: including file: C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\specstrings_undef.h*
2> Note: including file: C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\driverspecs.h
*2> Note: including file: c:\program files\microsoft sdks\windows\v7.0a\include\sdv_driverspecs.h*
2>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\driverspecs.h(356): error C3861: 'SAL_functionClass': identifier not found
2>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\driverspecs.h(356): error C2059: syntax error : ')'
2>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\driverspecs.h(374): error C2144: syntax error : 'char' should be preceded by ')'
2>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\driverspecs.h(374): error C3861: 'SAL_acquire': identifier not found
Please advise. Thanks.

Take a look at your VS include paths. If you installed more SDKS (ie, Windows 7.1 or others) then the order may have gotten screwed up. Or perhaps you modified the paths to add some of your own.
Go to Project->Properties->Configuration Properties->VC++ Directories->Include Directories. Mine looks like this:
Include Directories =$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;
I'd suggest making them look like the default and seeing if you still have the problem. You may have to fix your Library Directories if it doesn't link after it compiles. Mine looks like this:
Library Directories =$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib

Related

Using two different math libraries in the same project confuses Visual C++

My project needs to use both Micorsoft Visual C++ math.h and Intel MKL math.h.
Building with verbose details, I get:
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\cmath
1> Note: including file: E:\3rdParty\MKL\2017.1.143\windows\compiler\include\math.h
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\../../vc/include/math.h
1> Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\crtdefs.h
1> E:\3rdParty\MKL\2017.1.143\windows\compiler\include\math.h(1577): warning C4005: 'HUGE_VALF' : macro redefinition
1> C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\../../vc/include/math.h(104) : see previous definition of 'HUGE_VALF'
1> E:\3rdParty\MKL\2017.1.143\windows\compiler\include\math.h(1579): warning C4005: 'HUGE_VALL' : macro redefinition
1> C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\../../vc/include/math.h(105) : see previous definition of 'HUGE_VALL'
1> E:\3rdParty\MKL\2017.1.143\windows\compiler\include\math.h(1581): warning C4005: 'HUGE_VAL' : macro redefinition
1> C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\../../vc/include/math.h(96) : see previous definition of 'HUGE_VAL'
The "'HUGE_VALF' : macro redefinition" message is the one that made me be suspicious.
At first I just disabled that warning, but considering that this option would only mask a potential problem, I am looking for an alternative solution.
From lines 1 and 2, you can see that Visual Studio's cmath does not include Visual Studio's math.h, as it should, but MKL's file with the same name.
How can I set my CMakeLists.txt file so that the compiler can pick the right include files?
Just wrap one library.
For example, create header file:
#pragma once
namespace imath {
double sin(double a);
}
And in cpp
#include "Wrapper.h"
#include <intel/math.h>
namespace imath {
double sin(double a) {
return ::sin(a);
}
}
Do this for every symbol you need to use in common source.
And do not include C version of math.h you are using C++ so #include <cmath>.

Clang++ 4.0.0 compilation error in windows

I'm using clang 4.0.0 compiled from source on windows 10 (32-bit OS, x86 processor). I'm trying to compile my cpp code to llvm ir code of the format ll.
Here's a sample code which fails to compile using clang:
#include <windows.h>
#include <tlhelp32.h>
#include <fstream>
#include <mapi.h>
#include <memory>
#include<stdio.h>
/* Function to calculate x raised to the power y */
int power(int x, unsigned int y)
{
if (y == 0)
return 1;
else if (y%2 == 0)
return power(x, y/2)*power(x, y/2);
else
return x*power(x, y/2)*power(x, y/2);
}
/* Program to test function power */
int main()
{
int x = 2;
unsigned int y = 3;
printf("%d", power(x, y));
return 0;
}
This is just a sample code, but it's the same behavior across all c++ code which include the listed header files.
I use the following command to compile it to llvm ir code:
clang++ -S -emit-llvm assiral.cpp -o assiral.ll
On compilation I get the following error:
C:\Sample>clang++ -emit-llvm -S assiral.cpp -o assiral.ll
In file included from assiral.cpp:3:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\fstream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\includem:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ostream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ios:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xlocnum:7:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\cmath:617:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xtgmath.h:9:
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xtr1common:204:22: error:
use of undeclared identifier 'char16_t'
struct _Is_integral<char16_t>
^
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xtr1common:210:22: error:
use of undeclared identifier 'char32_t'
struct _Is_integral<char32_t>
^
In file included from assiral.cpp:3:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\fstream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\includem:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ostream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ios:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xlocnum:10:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\streambuf:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xiosbase:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xlocale:8:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\stdexcept:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\exception:7:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\type_traits:6:
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xstddef:257:2: error: 'auto'
return without trailing return type; deduced return types are a C++14 extension
auto _Unfancy(_Ptrty _Ptr)
^
In file included from assiral.cpp:3:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\fstream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\includem:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ostream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ios:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xlocnum:10:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\streambuf:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xiosbase:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xlocale:8:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\stdexcept:7:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xstring:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xmemory0:8:
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\limits:612:33: error: use of
undeclared identifier 'char16_t'
template<> class numeric_limits<char16_t>
^
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\limits:902:33: error: use of
undeclared identifier 'char32_t'
template<> class numeric_limits<char32_t>
^
In file included from assiral.cpp:3:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\fstream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\includem:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ostream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ios:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xlocnum:10:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\streambuf:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xiosbase:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xlocale:8:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\stdexcept:7:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xstring:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xmemory0:10:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xutility:8:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\utility:7:
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\iosfwd:254:21: error: use of
undeclared identifier 'char16_t'
struct char_traits<char16_t>
^
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\iosfwd:263:21: error: use of
undeclared identifier 'char32_t'
struct char_traits<char32_t>
^
In file included from assiral.cpp:3:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\fstream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\includem:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ostream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ios:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xlocnum:10:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\streambuf:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xiosbase:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xlocale:8:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\stdexcept:7:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xstring:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xmemory0:10:
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xutility:698:2: error:
'auto' return without trailing return type; deduced return types are a C++14 extension
auto _Unchecked_n(_Iter _Src, _Diff)
^
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xutility:742:2: error:
'auto' return without trailing return type; deduced return types are a C++14 extension
auto _Unchecked_n_backward(_Iter _Src, _Diff)
^
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xutility:1142:12: error:
deduced return types are a C++14 extension
constexpr decltype(auto) _Operator_arrow(_Iterator&& _Target, false_type)
^
In file included from assiral.cpp:3:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\fstream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\includem:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ostream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ios:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xlocnum:10:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\streambuf:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xiosbase:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xlocale:8:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\stdexcept:7:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xstring:6:
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xmemory0:356:2: error:
'auto' return without trailing return type; deduced return types are a C++14 extension
auto _Const_cast(_Ptrty _Ptr)
^
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xmemory0:366:2: error:
'auto' return without trailing return type; deduced return types are a C++14 extension
auto _Const_cast(_Ty * _Ptr)
^
In file included from assiral.cpp:3:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\fstream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\includem:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ostream:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\ios:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xlocnum:10:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\streambuf:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xiosbase:6:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xlocale:8:
In file included from C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\stdexcept:7:
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xstring:75:2: error:
statement not allowed in constexpr function
for (auto _Match_try = _Haystack + _Start_at; ; ++_Match_try)
^
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xstring:119:3: error:
statement not allowed in constexpr function
for (auto _Match_try = _Haystack + _Min_value(_Start_at, _Hay_size - _Needle_size); ; --_Match_try)
^
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xstring:144:3: error:
statement not allowed in constexpr function
for (auto _Match_try = _Haystack + _Min_value(_Start_at, _Hay_size - 1); ; --_Match_try)
^
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xstring:169:3: error:
statement not allowed in constexpr function
for (auto _Match_try = _Haystack + _Start_at; _Match_try < _End; ++_Match_try)
^
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xstring:188:3: error:
statement not allowed in constexpr function
for (auto _Match_try = _Haystack + _Min_value(_Start_at, _Hay_size - 1); ; --_Match_try)
^
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xstring:213:3: error:
statement not allowed in constexpr function
for (auto _Match_try = _Haystack + _Start_at; _Match_try < _End; ++_Match_try)
^
C:\Program Files\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\include\xstring:233:3: error:
statement not allowed in constexpr function
for (auto _Match_try = _Haystack + _Start_at; _Match_try < _End; ++_Match_try)
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
What I expect after running the command is to have the bytecode file generated (.ll file). I've seen many posts where they introduce a flag : '-fms-compatibility-version=19' along with the command. However the flag added gets flagged as an unknown argument. I'm working with MSVS 2017. Maybe I'm using this flag wrong. But I've been at this impasse for a day now. Any help or suggestion would be greatly appreciated.
This was fixed by adding the correct path to the header files in the environment variable INCLUDE. Most of my errors were resolved once I fixed the paths. This includes the error where compiling a c++ file which references certain headers like windows.h gives a file not found.
Link on how to do the same : List all environment variables from command line?
You can also fix another issue which is :
link fatal error lnk1104 cannot open file 'libcmt.lib'
by setting the LIBPATH environment variable to point to the right location of the libcmt.lib file. I found mine at:
C:\Program Files\Microsoft Visual Studio 14.0\VC\lib
These trivial issues left me spending quite a few days to figure out. Hope this saves someone the same trouble.

Windows - only the first entry of PATH-environment variable can be found

The following problem with my PATH-environment variable I have for some time, and it's become untolerable annoying so I would appreciate help a lot.
The following is the content of my system environment variables, which is also the output of echo %PATH% on cmd-exe.
C:\MinGW\bin; C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin; C:\msys\1.0\bin; C:\Qt\5.3\msvc2013_64\bin; C:\Users\Public\Documents\Embarcadero\Studio\15.0\Bpl;C:\Program Files (x86)\Embarcadero\Studio\15.0\bin64;C:\Users\Public\Documents\Embarcadero\Studio\15.0\Bpl\Win64;C:\Program Files\doxygen\bin;%ANT_HOME%\bin; %JAVA_HOME%\bin; %M2_HOME%\bin; C:\Program Files (x86)\MiKTeX 2.8\miktex\bin; C:\Program Files\PDF Split And Merge Basic\bin; C:\Program Files\Microsoft\Web Platform Installer; C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files (x86)\Windows Live\Shared;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\SlikSvn\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\doxygen\bin
The thing is now, that only the first entry of this can be used, i.e the command "g++" (which is in C:\MinGW\bin ) can be found, but already the command "cl" (which is in C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin) can't be found, and all subsequent commands also not.
What am I doing wrong?

'identifier' : redefinition errors ( error C2011 & error C2370)

Every time I try to compile my code, I get a huge amount of errors. It's not a problem with my code, cause it was working just fine on another computer. I tried re-installing and fixing, but that didn't help. Here's the whole error message:
1>------ Build started: Project: Raptor Triangle 2, Configuration: Debug Win32 ------
1> Raptor Triangle 2.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(57): error C2011: 'vc_attributes::YesNoMaybe' : 'enum' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(57) : see declaration of 'vc_attributes::YesNoMaybe'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(67): error C2011: 'vc_attributes::AccessType' : 'enum' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(67) : see declaration of 'vc_attributes::AccessType'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(81): error C2011: 'vc_attributes::Pre' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(81) : see declaration of 'vc_attributes::Pre'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(78): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(112): error C2011: 'vc_attributes::Post' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(112) : see declaration of 'vc_attributes::Post'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(109): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(143): error C2011: 'vc_attributes::FormatString' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(143) : see declaration of 'vc_attributes::FormatString'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(155): error C2011: 'vc_attributes::InvalidCheck' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(155) : see declaration of 'vc_attributes::InvalidCheck'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(152): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(165): error C2011: 'vc_attributes::Success' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(165) : see declaration of 'vc_attributes::Success'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(176): error C2011: 'vc_attributes::PreBound' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(176) : see declaration of 'vc_attributes::PreBound'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(173): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(186): error C2011: 'vc_attributes::PostBound' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(186) : see declaration of 'vc_attributes::PostBound'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(183): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(196): error C2011: 'vc_attributes::PreRange' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(196) : see declaration of 'vc_attributes::PreRange'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(193): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(208): error C2011: 'vc_attributes::PostRange' : 'struct' type redefinition
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(208) : see declaration of 'vc_attributes::PostRange'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(205): error C3094: 'repeatable': anonymous usage not allowed
1> e:\programs\c++\raptor triangle 2\raptor triangle 2\predefined c++ attributes (compiler internal)(147) : see declaration of 'repeatable'
1> attribute can only be applied to: 'class', 'struct'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(245): error C2370: 'SA_Yes' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(245) : see declaration of 'SA_Yes'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(246): error C2370: 'SA_No' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(246) : see declaration of 'SA_No'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(247): error C2370: 'SA_Maybe' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(247) : see declaration of 'SA_Maybe'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(250): error C2370: 'SA_NoAccess' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(250) : see declaration of 'SA_NoAccess'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(251): error C2370: 'SA_Read' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(251) : see declaration of 'SA_Read'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(252): error C2370: 'SA_Write' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(252) : see declaration of 'SA_Write'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(253): error C2370: 'SA_ReadWrite' : redefinition; different storage class
1> c:\program files\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(253) : see declaration of 'SA_ReadWrite'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Help? Haha. I don't get it. I looked up the error codes but couldn't figure out what to do.
Also, I can post the code if need be, but it's pretty long.
EDIT: I solved it, but I don't get why. I got rid of my line to include windows.h, which I needed for Sleep(). I still don't get why that matters though.
Another cause of C2370 is when multiple copies of a header file, containing a constant, exist.
Different projects then access different copies of the same header file, breaking the '#pragma once' and causing 'C2370 redefinition; different storage class'.
A common reason for file duplication to exist is when developers make a local copy of dependent library headers while a globally accessible still SDK exists.
You need to form your header file as following:
#ifndef HEADERFILENAME_DEF
#define HEADERFILENAME_DEF
/* all declarations here */
#endif
This will prevent double inclusion of a header file.
The object files must be out of date. Try a clean build - i.e. Clean/Build. windows.h should have nothing to do with it.
I had the same problem with VS2008. I resolved with:
change Yes (/Wp64) --> No

VS2005 C++ compiler problem including <comdef.h> in MFC application

I am having some trouble converting an old project from VS6 to VS2005. At one place in the code it uses the type variant_t so it includes comdef.h for this purpose. comdef.h then includes comutil.h which generates these errors for me:
c:\program files\microsoft visual studio 8\vc\include\comutil.h(978) : error C2535: '_variant_t::_variant_t(int) throw()' : member function already defined or declared
c:\program files\microsoft visual studio 8\vc\include\comutil.h(970) : see declaration of '_variant_t::_variant_t'
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1007) : error C2535: '_variant_t::operator int(void) const' : member function already defined or declared
c:\program files\microsoft visual studio 8\vc\include\comutil.h(998) : see declaration of '_variant_t::operator int'
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1037) : error C2535: '_variant_t &_variant_t::operator =(int)' : member function already defined or declared
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1029) : see declaration of '_variant_t::operator ='
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1331) : error C2084: function '_variant_t::_variant_t(int) throw()' already has a body
c:\program files\microsoft visual studio 8\vc\include\comutil.h(970) : see previous definition of '{ctor}'
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1588) : error C2084: function '_variant_t::operator int(void) const' already has a body
c:\program files\microsoft visual studio 8\vc\include\comutil.h(998) : see previous definition of '.H'
c:\program files\microsoft visual studio 8\vc\include\comutil.h(2006) : error C2084: function '_variant_t &_variant_t::operator =(int)' already has a body
c:\program files\microsoft visual studio 8\vc\include\comutil.h(1029) : see previous definition of '='
There is probably some configuration that is incorrect, some define missing or some include file I should have included but I can't seem to find the problem. Any pointers in the right direction is much appreciated
This looks like one of two things, an include order problem or as you stated something not getting defined but I am leaning towards the first one. You might want to check msdn and make sure there are no restrictions on when comutil.h can be included (I know this is an issue if you include winsock2.h before windows.h). There is also an option under C/C++ > Advanced to Show Includes (/showIncludes option from the command-line) which is generally helpful when trying to track issues like this down.
Does your own code do something like this:
#define long int