Visual Studio cannot find vcvars64.bat when compiling even though it exists - c++

When trying to compile a C++ file in Visual Studio 2019 the compiler gives me this error:
1>------ Build started: Project: ConsoleApplication4, Configuration: Debug Win32 ------
1>Program
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Program': No such file or directory
1>Files
1>c1xx : fatal error C1083: Cannot open source file: 'Files': No such file or directory
1>Microsoft
1>c1xx : fatal error C1083: Cannot open source file: '(x86)\Microsoft': No such file or directory
1>Visual
1>c1xx : fatal error C1083: Cannot open source file: 'Visual': No such file or directory
1>vcvars64.bat
1>c1xx : fatal error C1083: Cannot open source file: 'Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat': No such file or directory
1>ConsoleApplication4.cpp
1>Generating Code...
1>Done building project "ConsoleApplication4.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I'm assuming that happens because of the spaces causing issues? Any help on how to fix that?
Visual Studio 2019, using the "Local Windows Debugger" for a standard C++ console app. The vcvars64.bat exists.

Related

Visual Studio Compiling Cl doesn't interpret whitespace?

I'm trying to add CL (MSVC) to my sys env and executable directories, but an error pops up that is seperating the paths by whitespace.
1>------ Build started: Project: ConsoleApplication10, Configuration: Debug x64 ------
1>Program
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Program': No such file or directory
1>Microsoft
1>c1xx : fatal error C1083: Cannot open source file: 'Files\Microsoft': No such file or directory
1>Visual
1>c1xx : fatal error C1083: Cannot open source file: 'Visual': No such file or directory
1>x64
1>c1xx : fatal error C1083: Cannot open source file: 'Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\Hostx64\x64': No such file or directory
1>ConsoleApplication10.cpp
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\yvals.h(12,10): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
1>Generating Code...
1>Done building project "ConsoleApplication10.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========```

How can I resolve this compile error in Visual Studio 2015?

I am trying to compile CFortranTranslator in Visual Studio 2015.
Getting the following error:
1>------ Rebuild All started: Project: CFortranTranslator, Configuration: Debug x64 ------
2>------ Rebuild All started: Project: cpptest, Configuration: Debug x64 ------
1> Process "for90.y" bison file
2> main.cpp
1>C:\Users\pc\source\repos\CFortranTranslator\src\grammar\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: The command "
1>C:\Users\pc\source\repos\CFortranTranslator\src\grammar\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: start /B /WAIT /D "C:\Users\pc\source\repos\CFortranTranslator\src\grammar\" win_bison.exe --output="for90.tab.cpp" --defines="for90.tab.h" "for90.y"
1>C:\Users\pc\source\repos\CFortranTranslator\src\grammar\custom_build_rules\win_flex_bison_custom_build.targets(55,5): error MSB3721: exit /b %errorlevel%" exited with code 1.
2> cpptest.vcxproj -> C:\Users\pc\source\repos\CFortranTranslator\vsbuild\x64\Debug\cpptest.exe
2> cpptest.vcxproj -> C:\Users\pc\source\repos\CFortranTranslator\vsbuild\x64\Debug\cpptest.pdb (Partial PDB)
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
the flex-bison is already in the designated directory:
So, what should I do to resolve this?
EDIT: After following Robert's instructions, the errors related to Flex/Bison are gone. Thanks to him.
But, now, I see that the application is not finding Boost, even though it is installed already.
1>------ Rebuild All started: Project: CFortranTranslator, Configuration: Debug x64 ------
1> Process "for90.y" bison file
1> Process "for90.l" flex file
1> lazygen.cpp
1> gen_variable.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_vardef.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_type.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_suite.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_stmt.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_select.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_program.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_paramtable.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_label.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_io.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_if.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_function.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_feature.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_exp.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_doc.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_do.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_dimenslice.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_config.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_callable.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> Generating Code...
1> Compiling...
1> gen_attr_describer.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_arraybuilder.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> gen_common.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> Variable.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> tokenizer.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> parser.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> Intent.cpp
1> Function.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> attribute.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> main.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> simple_lexer.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> for90.tab.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\src\grammar\for90.tab.cpp': No such file or directory
1> getopt2.cpp
1> develop.cpp
1>c:\users\pc\source\repos\calvinneo\cfortrantranslator\src\parser\variable.h(22): fatal error C1083: Cannot open include file: 'boost/optional/optional.hpp': No such file or directory
1> forstdio.cpp
1> forlang.cpp
1> forfilesys.cpp
1> for90std.cpp
1> farray.cpp
1> Generating Code...
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
EDIT-2:
I resolved Boost-issue.
Now, I am having the following error:
for90.tab.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\src\grammar\for90.tab.cpp': No such file or directory
Open the file:
... \CFortranTranslator\src\grammar\custom_build_rules\win_flex_bison_custom_build.props
Go to line 16,17,18 which reads
<CommandLineTemplate>
start /B /WAIT /D "%(RootDir)%(Directory)" win_bison.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)"
exit /b %errorlevel%</CommandLineTemplate>
Replace with (only 1 line):
<CommandLineTemplate>start /B /WAIT /D "%(RootDir)%(Directory)" win_bison.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)" & exit /b %errorlevel%</CommandLineTemplate>
On (now) lines 34,35,36:
<CommandLineTemplate>
start /B /WAIT /D "%(RootDir)%(Directory)" win_flex.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)"
exit /b %errorlevel%</CommandLineTemplate>
Replace with (only 1 line):
<CommandLineTemplate>start /B /WAIT /D "%(RootDir)%(Directory)" win_flex.exe [AllOptions] [AdditionalOptions] "%(Filename)%(Extension)" & exit /b %errorlevel%</CommandLineTemplate>
Save the file and BUILD

Error C1083: How do I fix my broken Visual Studio compiler?

My Visual Studio always fails to compile any C++ program. I have not tampered or modified the compiler.
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
}
Gives Output:
1>Program
1>c1xx : fatal error C1083: Cannot open source file: 'C:\Program': No such file or directory
1>Files
1>c1xx : fatal error C1083: Cannot open source file: 'Files': No such file or directory
1>Microsoft
1>c1xx : fatal error C1083: Cannot open source file: '(x86)\Microsoft': No such file or directory
1>Visual
1>c1xx : fatal error C1083: Cannot open source file: 'Visual': No such file or directory
1>x64
1>c1xx : fatal error C1083: Cannot open source file: 'Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64': No such file or directory
1>test.cpp
1>Generating Code...
1>Done building project "test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I think that one of the paths is missing double quotes but I don't know where to fix this.
I suggest that you could check if the following path settings are correct.
Windows Settings->Advanced system settings->Environment Varibles->Path->Environment variable
Visual Studio Project->Properties->VC++ Directories->Include Directories
If it still doesn't work, you could reset the Environment Varibles in Tools->Import and Export Settings->Reset all settings.

fatal error C1083: Cannot open include file: 'iostream'; Also getting error -> No such file or directory and 'stdlib.h'

I keep getting these issues when trying to compile this certain project :
1>------ Build started: Project: X, Configuration: Debug Win32 ------
1>ESPWork.cpp
1>D:\X\test\ESPWork.cpp(1,9): fatal error C1083: Cannot open include file: 'iostream': No such file or directory
1>Source.cpp
1>D:\X\test\Source.cpp(1,9): fatal error C1083: Cannot open include file: 'iostream': No such file or directory
1>MemoryManager.cpp
1>D:\X\test\MemoryManager.cpp(1,9): fatal error C1083: Cannot open include file: 'iostream': No such file or directory
1>DirectXM.cpp
1>D:\MicrosoftDirectXSDK\Include\d3d9.h(37,10): fatal error C1083: Cannot open include file: 'stdlib.h': No such file or directory
1>Generating Code...
1>Done building project "test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have include directories set to (D:\MicrosoftDirectXSDK\Include)
and library directories set to (D:\MicrosoftDirectXSDK\Lib\x86)
New issue:
1>------ Build started: Project: SAFU_IRAQ, Configuration: Debug Win32 ------
1>DirectXM.cpp
1>D:\Eary\test\MemoryManager.h(7,32): error C2039: 'wstring': is not a member of 'std'
1>D:\Stufff\VC\Tools\MSVC\14.24.28314\include\list(24): message : see declaration of 'std'
1>D:\Eary\test\MemoryManager.h(7,39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\Eary\test\MemoryManager.h(7,39): error C2143: syntax error: missing ',' before '&'
1>Done building project "test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Building errors with visual studio

I have a solution for a previous c++ project provided to me. When I open the solution in visual studio and try to build, I get the error:
1>------ Build started: Project: Test Proj, Configuration: Release Win32 ------
1>Build started 9/19/2011 8:28:56 PM.
1>InitializeBuildStatus:
1> Touching "Release\Test Proj.unsuccessfulbuild".
1>ClCompile:
1> example1.cpp
1>c:\users\mycomp\downloads\stp\testp\code\Angel.h(38): fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory
1> InitShader.cpp
1>c:\users\mycomp\downloads\stp\testp\code\Angel.h(38): fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.85
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I had to change the input linker settings of my project to include glew32d.lib. That fixes it, and it compiles and runs properly.
However, when I alter example1.cpp(even by just adding a comment), I am no longer able to build it and I get this error:
1>------ Build started: Project: Test Proj, Configuration: Release Win32 ------
1>Build started 9/19/2011 8:25:29 PM.
1>InitializeBuildStatus:
1> Creating "Release\Test Proj.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> example1.cpp
1>c:\users\mycomp\downloads\stp\testp\code\Angel.h(38): fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.67
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
glew32d is still being linked so I'm not sure where I'm getting the error and why I can't build
That's not a linker error, it's a compile error.
c:\users\mycomp\downloads\stp\testp\code\Angel.h(38): fatal error C1083:...
^^^^^^^^^^^
I bet on line 38 of Angel.h, you're trying to include...
...Cannot open include file: 'GL/glew.h': No such file or directory
^^^^^^^^^^^
...and the compiler can't find the header file.
You need to make sure that the OpenGL header files (whatever folder contains a folder named GL that contains a file called glew.h) are available to the compiler; you can add this folder to the Additional Include Directories in the properties of your C++ project.