visual studio 2010 error - c++

When I press Ctrl+F5, I get project out of date debug win32.
Yes:
Would you like to continue and run the last build? (Yes)
\visual studio 2010\project\test123\debug\test123.exe isi not recognized as an internal or external command, operable program or batch file
No:
Would you like to continue and run the last build? (No)
\visual studio 2010\project\test123\debug\test123.exe isi not recognized as an internal or external command, operable program or batch file
If I run code I did on my Visual Studio in class, it works perfectly (files are saved in USB).
It's not a syntax error; I am guessing I'm missing some files but don't know how to fix it.

Open your project properties and make sure that your startup path is correct. VS can't find your exe, so I am assuming that it is not there for whatever reason.

It mean's Visual Studio can't find your exe file, or the exe doesn't exist. Why not create a new project, c/p all the code, and rebuild?

Related

qt creator 5.10 failed to retrieve msvc environment error

i just installed qt creator 5.10 and i opened a simple widget application this is the error that i get even without running the application
:-1: error: Failed to retrieve MSVC Environment from "D:\pograml files\visual studio2\VC\Auxiliary\Build\vcvarsall.bat":
'chcp' is not recognized as an internal or external command,
operable program or batch file.
'wmic' is not recognized as an internal or external command,
operable program or batch file.
i haven't found any solutions for this, if anyone could help me i would be very thankful
When Qt starts, I used to get a list of 10 errors related to MSVC kit because each detected MSVC platform compiler has an Initialization script for setting environment. like:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat x86_amd64
I traced the failure by running all Initialization one by one on same command line (cmd) window; In the beginning I used to run only Initialization for x86_amd64 which runs without errors thus I didn't notice anything wrong. But on same window running Initialization for next compiler " ...\vcvarsall.bat x86_amd64" the error appeared which in my case was something like:
" ..program Files\MySQL\Utilities xxx was not expected at this time"
I just checked and found that path does not exist at all in my storage, so I removed it from PATH system env settings, and surprised things went normal after that!
To add to the answer of #John Wesley, I too had to alter my system's PATH enviroment variable to fix the "failed to retrieve msvc environment" error. However, my problem was slightly different.
In short, remove any unused directories from your PATH.
To explain, my PATH contained the following entries in the following order:
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;
C:\ProgramData\Oracle\Java\javapath;
C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\Intel\iCLS Client\;
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
[lots more enties followed...]
Hence my case was different to John's because it already had the required entries of:
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
The fix for my system was to delete the first two entries (which I do not need because I manually set my Java paths). After I did that, I reopened Qt Creator and it worked!
It has been working for the past week without problem, however, sometimes the message "failed to retrieve msvc environment" still pops up for a moment, but then disappears again.
I met this error building qt project in Qt Creator. then solved by adding some paths to my system path, which not included them before.
C:\Windows\System32
C:\Windows
C:\Windows\System32\Wbem
Then reopen Qt Creator.
I faced the same problem as you. I use Visual Studio 2017 Community Edition with Qt 5.6.0. Windows 10.
In the beginning, I used "Visual Studio Installer" to repair. However it does not work.
Then I append "C:\Windows\System32" to "PATH" variable to Environment variables" since chcp is a exe in System3 and somehow I cannot find "C:\Windows\System32" in "PATH".
After that, I delete the Visual Studio (C:\Program Files (x86)\Microsoft Visual Studio) directly from File Explorer. ( I shift+deleted it )
Then re-install the "Visual Studio 2017" again.
It works!
I do not know which step is important. I think to add System32 to PATH variable and re-install VS2017 may the solution
In my case, I found the problem in my System Path variable. If the Path contains double quote anywhere, Qt emits this error.
I have meet the "error: Failed to retrieve MSVC Environment" for no reason. I deleated the debug file of my project and it does work.

Programs Will Not Run In Visual Studio

My programs will not run in VS. I can code it, but it will not debug or start. It says:
Unable to start program 'C:\Users\Bob\Documents\Visual Studio 2013\Projects\Crankexe2\Debug\Crankexe2.exe'. The system cannot find the file specified.
This goes for all other programs as well.
What is happening?
Why do you open exe file using VS? if you want to open project, please choose sln file. If you want to run this, shortcut ctrl+f5 or using window explorer go to path "C:\Users\Bob\Documents\Visual Studio 2013\Projects\Crankexe2\Debug\" and open file "Crankexe2.exe"

Visual Studio 2012 does not generate exe

I've a C++ project in Visual Studio 2012 Express, and I started having problems lately. When I compile the project it works, nothing wrong, however when I try to execute it the .exe disappears. I mean, I compile the project, the project generates the exe file with no problems, but if I try to execute it from Visual Studio or directly from the output directory, Windows say to me:
Cannot start the program 'C:\Users\Adrian\Dropbox\MyApp\Debug\MyApp.exe'.
The system can not find the file specified
If I create another project, Hello World for example, there is no problem and the exe generates and executes good. So I guess the problem is specific to my project. I tried disabling Avast (because maybe he delete the file) and the problem persists.
Also I create another project, including the files and... the problem is still here...
I check the project options, specifically general and debug options and I see nothing wrong.
So does anyone have an idea what may be wrong?
The output directory is $(SolutionDir)$(Configuration)\ and I'm compiling in Debug mode.
The windows error message is misleading. It should state that, loading a library (dll) failed. You might run the program with a process monitor (see: http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx)

Run .bat file on VS cmd prompt

I have created a compile.bat and run.bat files, but when I double click on them they run on the Windows cmd prompt instead of the VS cmd prompt.
This is what I have in my compile.bat file:
devenv FileMgr.sln /rebuild debug
pause
The Windows cmd says "'devenv is not recognized as an internal or external command, operable program or batch file."
If I recall correctly, all the Visual Studio Command Prompt is is a batch script itself that initializes paths and environment variables. So if you simply call that batch script at the top of yours, you'll have all those settings for your script.
According to this question, MSVC 2008 has that batch file here:
call "C:\Program Files\Microsoft Visual Studio 2008\VC\vcvarsall.bat
It may not be in exactly the same place, but it should be something similar on your machine.
you need devenv.exe to be present at location where your compile.bat is running. Please look at solution given here-
Simply type devenv.exe from the command line. If you get a message like this, then you do not have devenv.exe in your path. >>> 'devenv.exe' is not recognized as an internal or external command, operable program or batch file. >>> To fix this simply run the batch file, vsvars32.bat that comes with Visual Studio.NET from the command line in the working folder. After you run this batch file devenv.exe will be available from the command line in that folder.
http://windowsclient.net/blogs/faqs/archive/2006/05/26/how-do-i-start-visual-studio-from-the-command-line.aspx
I would usually copy the devenv.exe manually to the location where my bat file is kept.
The VS cmd prompt sets some additional environment variables and adds data to existing (eg the PATH variable). You might consider adding the path of devenv to you normal path.
You may specify full path of devenv.exe:
C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\devenv.exe FileMgr.sln /rebuild debug
But your batch file won't be portable to other machines/IDEs.

Visual Studio Command Prompt

As soon as I open the VS cmd prompt it says "ERROR: Cannot determine the location of the VS Common Tools folder." I'm trying to compile and eventually run my program using a compile.bat and run.bat file.
My program successfully compiled ONCE when I had the following in my compile.bat file:
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
FileMgr.sln /rebuild debug
pause
After it worked, I tried adding the path of vcvarsall.bat in the variable "Path" in Environment Variables, hoping I wouldn't need that initial call line in the .bat file. This didn't work so I deleted the newly added path from "Path" but now I'm getting this error.
This can only go wrong if the registry is messed up on your machine or the VS install didn't go well. The .bat file reads the setting from the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7\10.0 value. Insert Wow6432Node for a 64-bit operating system. Double-check with regedit.exe, the SysInternals' ProcMon utility is always handy to troubleshoot registry problems.
Get your machine stable again, ask questions about that at superuser.com. Try a VS2010 repair to fix the registry first, reinstall next. Shove it out of a 4th story window if all fails.