Visual Studio 2015 doesn't have cl.exe
Visual Studio 2015 doesn't install C++ by default. You have to rerun the setup, select Modify and then check Programming Language -> C++
Where is cl.exe? (MS Build Tools ’13)
Otherwise, is there any cross-platform graphics library (at least for Windows and Mac) that doesn’t need MSVC++
Yes, you should be able to use modern OpenGL in a cross-platform way under Mingw using
GLFW (since it's a CMAKE compile-it-yourself library) and the excellent GLAD for handling loading of the modern openGL API on windows.
Visual Studio 2015 Update 3 - C++ Compiler bug?
Yes, it's a bug. Specifically, it's a bug in the new SSA optimizer introduced in VS2015 Update 3. The undocumented command line option -d2SSAOptimizer-
tells the compiler backend to use the old optimizer instead, which causes the bug to not manifest.
FYI, you can minimize your repro to:
int main()
{
volatile int someVar = 1;
const int indexOffset = someVar ? 0 : 1;
for (int i = 1 - indexOffset; i < 2 - indexOffset; ++i)
{
return 0;
}
return 1;
}
which will help the compiler developers localize the problem more quickly.
Addition from Codeguard (I decided that Casey's answer should be THE answer):
I have received reply from Microsoft (Gratian Lup, author of blog post Introducing a new, advanced Visual C++ code optimizer):
Yes, this is indeed a bug in the SSA Optimizer itself - usually most
bugs reported as being in the new optimizer are in other parts,
sometimes exposed now after 20 years.It's in a small opt. that tries to remove a comparison looking like (a
- Const1) CMP (a - Const2), if there is no overflow. The issue is that your code has (1 - indexOffset) CMP (2 - indexOffset) and subtraction
is not commutative, of course - but the optimizer code disregards that
and handles (1 - indexOffset) as if it's (indexOffset - 1).A fix for this issue will be released in the next larger update for
VS2017. Until then, disabling the SSA Optimizer would be a decent
workaround. Disabling optimizations for only this function may be a
better approach if it doesn't slow down things too much. This can be
done with #pragma optimize("", off):
https://msdn.microsoft.com/en-us/library/chh3fb0k.aspx
How can I use the Visual Studio C/C++ Compiler (cl.exe) to pre-process my objective-C code?
I finally figured it out.
The cl.exe /Tp /E /I
command could work to some extend preprocessing both objective-c (.m)
and c (.c)
source files. However it fails to parse few of the COM
related code.
Then I found an open-source C-Pre-Processor that can successfully preprocess .c, .cpp and .m files
. The benefit of this tool is, it supports C++ 11 features as well e.g. variadic template etc.
How come cl.exe (Visual Studio compiler) fails to compile a project with CMake (error-report)?
It turns out that the problem in my case is that the username for my computer contains an apostrophe. Definitely a strange bug.
2020: nvcc fatal : Cannot find compiler 'cl.exe' in PATH
Thanks to @talonmies, the solution is as follows:
Firstly, c++ package doesn't come by default with a clean new installation of VS, you need to select the package.
Secondly, it seems that now the path for cl.exe is here
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x64
Related Topics
Splitting a String by a Character
C++ #Include <Atlbase.H> Is Not Found
Unordered_Map Hash Function C++
Does Std::Vector *Have* to Move Objects When Growing Capacity? Or, Can Allocators "Reallocate"
Can a Bool Read/Write Operation Be Not Atomic on X86
Opengl Define Vertex Position in Pixels
Static Constexpr Member of Same Type as Class Being Defined
Sorting Two Corresponding Arrays
What's a Use Case for Overloading Member Functions on Reference Qualifiers
C++ For-Loop - Size_Type VS. Size_T
Accessing Environment Variables in C++
May Std::Vector Make Use of Small Buffer Optimization
C++ Object Size with Virtual Methods
Convert Std::Tuple to Std::Array C++11