VS2011 code analysis - c++

I recently installed the VS2011 beta to get a feel for the new C++11 features Microsoft had implemented in the latest release of their compiler.
I've had an unexpected problem when going back to use VS2010 though. I've opened a Windows SDK 7.1 sample project in VS2010.
Now when I build in VS2010, I get the following output, denoting that a code analysis tool is being executed (seemingly after compilation, but before linking)
1>------ Rebuild All started: Project: MFCaptureToFile, Configuration: Debug Win32 ------
1> winmain.cpp
1> capture.cpp
1> Running Code Analysis for C/C++...
1>capture.cpp(112): error C2220: warning treated as error - no 'object' file generated
1>c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\mediafoundation\mfcapturetofile\capture.cpp(105): warning C6309: Argument '3' is null: this does not adhere to function specification of 'IMFAttributes::GetAllocatedString'
1>c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\mediafoundation\mfcapturetofile\capture.cpp(105): warning C6387: 'argument 3' might be '0': this does not adhere to the specification for the function 'IMFAttributes::GetAllocatedString': Lines: 98, 103, 105
1>c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\mediafoundation\mfcapturetofile\capture.cpp(353): warning C6309: Argument '3' is null: this does not adhere to function specification of 'IMFAttributes::GetAllocatedString'
1>c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\mediafoundation\mfcapturetofile\capture.cpp(353): warning C6387: 'argument 3' might be '0': this does not adhere to the specification for the function 'IMFAttributes::GetAllocatedString': Lines: 336, 338, 340, 343, 351, 353
1>C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\ks.h(53): error C2220: warning treated as error - no 'object' file generated
1>c:\program files\microsoft sdks\windows\v7.1\include\ks.h(53): warning C6244: Local declaration of 'GUID_NULL' hides previous declaration at line '28' of 'c:\program files\microsoft sdks\windows\v7.1\include\cguid.h'
1> Generating Code...
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
I've attempted to determine what change to the project has caused code analysis tool to be executed, but I can't find anything in the project properties. I've tried reloading the project in VS2011, but there's no option for code analysis that I can turn off (as suggested on MSDN).
The project is completely native C++, I've never used C++ with CLR
Further, I've tried opening other projects (my own) and now they're also invoking this code analysis stage. This prevents building due to problems with Microsoft code in many cases! Builds seem to succeed in VS2011 beta.
Can anyone offer insight into how to turn this code analysis tool off? I would hope to leave VS2011 beta installed, so please refrain from suggesting uninstalling it, unless it's the only option!

I think only VS2010 Ultimate supports code analysis. I don't have VS2012 but I think you should edit the vcxproj file manually.
Look for one or both of these params if they exist inside your project file:
<RunCodeAnalysis>true</RunCodeAnalysis> and <EnablePREfast>true</EnablePREfast>
Change both values to false and it should work.
Please note that these names are used by VS2010 and I am unsure if they changed it in VS2012.

Related

Visual Studio 2013 crashes for non-static data member initialization

i wanna compile Trinitycore with visual studio 2013(x86 & x64 both tested) on windows 10
i get this error and i test every solutions such as:
1.change /Zm on Additional Options from /Zm500 to /Zm2000(Maximum)
2.disable precompiled headers
3.disable Optimization
4.re-install Visual Studio
5.re-install windows 10
visual studio error description:
Error 1 error C1001: An internal error has occurred in the compiler. \TrinityCore-3.3.5\src\server\game\Server\WorldSocket.cpp 256 1 game
Error 2 error C1060: compiler is out of heap space c\src\server\game\c1xx game
Error 3 error D8040: error creating or communicating with child process c\src\server\game\cl game
event log:
Faulting application name: CL.exe, version: 18.0.21005.1, time stamp: 0x524faabf
Faulting module name: c1xx.dll, version: 18.0.21005.1, time stamp: 0x524faa90
Exception code: 0xc0000005
Fault offset: 0x0025236e
Faulting process id: 0x1948
Faulting application start time: 0x01d19f24d391755f
Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\CL.exe
Faulting module path: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\c1xx.dll
Report Id: d98e09ae-0b18-11e6-b361-1008b14a12cc
Faulting package full name:
Faulting package-relative application ID:
vs output errors:
TrinityCore-3.3.5\src\server\game\Server\WorldSocket.cpp(256): fatal error C1001: An internal error has occurred in the compiler.
1> (compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\convert.cpp', line 9608)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
1> Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1> Opcodes.cpp
1>c1xx : fatal error C1060: compiler is out of heap space
1> An internal error has occurred in the compiler.
1> (compiler file 'msc1.cpp', line 1325)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
1> Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1>cl : Command line error D8040: error creating or communicating with child process
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
event log attached file:
Version=1
EventType=APPCRASH
EventTime=131060826745545591
ReportType=2
Consent=1
UploadTime=131060826747020586
ReportIdentifier=e3cb3d99-0b13-11e6-b361-1008b14a12cc
IntegratorReportIdentifier=e3cb3d98-0b13-11e6-b361-1008b14a12cc
WOW64=1
Response.BucketId=d11da6a9b6e3e8a8c8d50161959694bb
Response.BucketTable=1
Response.LegacyBucketId=-389226431
Response.type=4
Sig[0].Name=Application Name
Sig[0].Value=CL.exe
Sig[1].Name=Application Version
Sig[1].Value=18.0.21005.1
Sig[2].Name=Application Timestamp
Sig[2].Value=524faabf
Sig[3].Name=Fault Module Name
Sig[3].Value=c1xx.dll
Sig[4].Name=Fault Module Version
Sig[4].Value=18.0.21005.1
Sig[5].Name=Fault Module Timestamp
Sig[5].Value=524faa90
Sig[6].Name=Exception Code
Sig[6].Value=c0000005
Sig[7].Name=Exception Offset
Sig[7].Value=0025236e
DynamicSig[1].Name=OS Version
DynamicSig[1].Value=10.0.10586.2.0.0.256.48
DynamicSig[2].Name=Locale ID
DynamicSig[2].Value=1033
UI[2]=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\CL.exe
UI[3]=Microsoft (R) C//C++ Optimizing Compiler has stopped working
UI[4]=Windows can check online for a solution to the problem.
UI[5]=Check online for a solution and close the program
UI[6]=Check online for a solution later and close the program
UI[7]=Close the program
LoadedModule[0]=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\CL.exe
LoadedModule[1]=C:\Windows\SYSTEM32\ntdll.dll
LoadedModule[2]=C:\Windows\SYSTEM32\KERNEL32.DLL
LoadedModule[3]=C:\Windows\SYSTEM32\KERNELBASE.dll
LoadedModule[4]=C:\Program Files (x86)\MSBuild\12.0\bin\FileTracker.dll
LoadedModule[5]=C:\Windows\SYSTEM32\ADVAPI32.dll
LoadedModule[6]=C:\Windows\SYSTEM32\msvcrt.dll
LoadedModule[7]=C:\Windows\SYSTEM32\sechost.dll
LoadedModule[8]=C:\Windows\SYSTEM32\RPCRT4.dll
LoadedModule[9]=C:\Windows\SYSTEM32\SspiCli.dll
LoadedModule[10]=C:\Windows\SYSTEM32\CRYPTBASE.dll
LoadedModule[11]=C:\Windows\SYSTEM32\bcryptPrimitives.dll
LoadedModule[12]=C:\Windows\SYSTEM32\ole32.dll
LoadedModule[13]=C:\Windows\SYSTEM32\combase.dll
LoadedModule[14]=C:\Windows\SYSTEM32\GDI32.dll
LoadedModule[15]=C:\Windows\SYSTEM32\USER32.dll
LoadedModule[16]=C:\Windows\SYSTEM32\MSVCR120.dll
LoadedModule[17]=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\mspdb120.dll
LoadedModule[18]=C:\Windows\SYSTEM32\VERSION.dll
LoadedModule[19]=C:\Windows\SYSTEM32\IMM32.DLL
LoadedModule[20]=C:\Windows\SYSTEM32\CRYPTSP.dll
LoadedModule[21]=C:\Windows\system32\rsaenh.dll
LoadedModule[22]=C:\Windows\SYSTEM32\bcrypt.dll
LoadedModule[23]=C:\Windows\SYSTEM32\MSVCP120.dll
LoadedModule[24]=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\mspdbcore.dll
LoadedModule[25]=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\c2.dll
LoadedModule[26]=C:\Windows\SYSTEM32\SHLWAPI.dll
LoadedModule[27]=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\c1xx.dll
LoadedModule[28]=C:\Windows\system32\apphelp.dll
State[0].Key=Transport.DoneStage1
State[0].Value=1
FriendlyEventName=Stopped working
ConsentKey=APPCRASH
AppName=Microsoft (R) C//C++ Optimizing Compiler
AppPath=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe
ApplicationIdentity=00000000000000000000000000000000
i really confused because i am compile this project many times with this steps and with this visual studio.
Edit 1:
i create new Win32Project and i put this code on that:
#include "stdafx.h"
# define LENGTH 20
typedef unsigned char uint8_t;
typedef uint8_t uint8;
struct test
{
uint8 intT[LENGTH] = {};
};
and when i compile that i got this error again:
Error 1 error C1001: An internal error has occurred in the compiler. \Projects\Win32Project1\Win32Project1\Win32Project1.cpp 13 1 Win32Project1
An "internal compiler error" (or ICE) is, by definition, a compiler bug. There could well be code in your program that's triggering that bug. Your crash seems to be triggered by the use of a non-static data member initialisation (NSDMI), and Microsoft admits that their support for NSDMIs in Visual Studio 2013 was unreliable at best:
Unfortunately, the code in our compiler (some of it written 30 years ago) for handling initialization suffers from many longstanding architectural limitations. This code was sufficient for C++03-style initialization, but NSDMI, a C++11 feature, caused it to exhibit these limitations as severe bugs.
Given this, you may also wish to try simply upgrading your toolchain.
However, it could also be that your installation is completely broken/corrupted.
Either way, your first task is to reinstall Visual Studio and see whether the problem persists. Perhaps try compiling the project on a different computer.
If that doesn't fix it, you need to produce a minimal testcase and submit it to the developers for review (at MS Connect). Please be sure to come back here and link us to the posted issue so that I can update the answer with any pertinent information from the developers (e.g. version the bug is fixed in).
OK Finally Problem Solved, Only Need Update Visual Studio 2013 to Visual Studio 2013 Update 5.
On Update 5 For Visual Studio 2013 this bug is fixed completely.
Thank you "Lightness Races in Orbit" And "Niall" for answer and helps :)
i am so happy
This is a ICE (an internal compiler error). It is cause by the code around line 256 of the WorldSocket.cpp file.
In that file; the class AuthSession, here uses non-static default member initialisation (NSDMI) with an array (on line 256) that is shown in the error message.
IIRC, VS2013 does not fully support the NSDMI feature. It was added to C++11 but VS2013 had limitations in its implementation of NSDMI.
The uint8 Digest[SHA_DIGEST_LENGTH] = {}; could just be too much for it to compile.

C++ Visual Studio 2012 issues

Updated problem #3
I've narrowed the problem. It seems that simply including <thread> makes the compiler go mad.
I am not even making any thread calls, just including it.
I have tried enabling /EHsc and also disabling it.
Disabled, I get:
I get these 6 messages:
Error 1 error C2220: warning treated as error - no 'object' file generated (main.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 313 1 cefclient
Warning 2 warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (main.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 313 1 cefclient
Error 3 error C2220: warning treated as error - no 'object' file generated (Program.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 313 1 cefclient
Warning 4 warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (Program.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 313 1 cefclient
Error 5 error C3861: '__uncaught_exception': identifier not found (main.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 4774 1 cefclient
Error 6 error C3861: '__uncaught_exception': identifier not found (Program.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 4774 1 cefclient
And if enabled (Configuration Properties -> C/C++ -> Code Generation & in the Command Line)
Error 1 error C3861: '__uncaught_exception': identifier not found (main.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 4774 1 cefclient
Error 2 error C3861: '__uncaught_exception': identifier not found (Program.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 4774 1 cefclient
I did a simple test with a new, blank project, including thread and just compiling. It went fine, no errors.
However in my main project I am using Chromium Embedded Framework v3, which seems to interact strangely with the thread inclusion?
Seems odd that simply including it would make such a mess.
Any ideas?
Update:
By removing the _HAS_EXCEPTIONS=0 flag entirely and rebuilding the project from CMake, I enter a state where the project won't even compile.
Due to this change it throws out a ton of warnings and errors from various files.
Errors such as:
Warning 230 warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (C:\Users\mads\Desktop\cef_binary_3.2526.1347.gcf20046_windows32\cefclient\browser\client_handler_osr.cc) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale 337 1 cefclient
According to a lot of asking around and googling, the solution to this is to specify /EHsc in Project Properties -> C/C++ -> Code Generation -> Enable C++ Exceptions = Yes(/EHsc).
As well as setting the flag /EHsc in the Command Line input field.
However, nothing changes. The same errors come out as if nothing was changed.
Update:
The error
Warning 2 warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (C:\Users\mads\Desktop\cef_binary_3.2556.1368.g535c4fb_windows32\libcef_dll\transfer_util.cc) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale 337 1 libcef_dll_wrapper
comes from the project "libcef_dll_wrapper", despite the fact that I HAVE speficied /EHsc in its project settings! Both in C++ -> Code Generation page and the Command Line
Solution edit:
Turns out that cmake files would override my set settings everytime I attempted to build or run the project, hence rendering any changes I made un-used, despite being set!
I was able to solve the problem by editing the project's cmake files directly.
Never used cmake before, so in the end it became a learning experience.
I have tested my project with thread inclusion now and it compiles as expected!
Thanks to all for great suggestions
Make sure neither the code nor the compiler command line define _HAS_EXCEPTIONS=0.
Compiling VC++ 12.0 with _HAS_EXCEPTIONS=0 and including concrt.h causes a compiler error:
If a source file is compiled with VC++ 12.0 with _HAS_EXCEPTIONS set to 0 and the source includes, whether directly or indirectly, concrt.h, the compiler gives an error of:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\concrt.h(4774) : error C3861: '__uncaught_exception': identifier not found
[...] Macro _HAS_EXCEPTIONS=0 is undocumented and unsupported by Microsoft.
It may work with some parts of the STL library for legacy reasons, but it won't be compatible with ConcRT library (concrt.h) since ConcRT depends on exceptions for cancellation.

What causes MS Visual Studio to be unable to recognize build errors?

In Visual Studio Express 2010, I can usually only build a program once and then to make any changes I have to paste my code into a new project. It will say that the build was successful, but then I try to run it and get an error message saying,
"This project is out of date-- would you like to build it?"
and I click yes and I get another error message saying that there were build errors and I have to continue from the last successful build. Sometimes instead of running the last successful build I get an error message saying,
"Unable to open [directory to program]. The system cannot find the
file specified."
I usually use Visual Express 2012 for this reason but even then it happens every now and then, seemingly at random. Once the issue begins there is no apparent way to fix it (rebuilding and restarting Visual Studio both have the same result). In Visual Studio Pro 2012 this also seems to happen.
EDIT: This is in the output box of the one in front of me (2010 edition)
1>------ Build started: Project: Lab01, Configuration: Debug Win32 ------
1> Lab01.cpp
1>c:\program files (x86)\reference assemblies\microsoft\framework\.netframework\v4.0\system.core.dll : warning C4945: 'ExtensionAttribute' : cannot import symbol from 'c:\program files (x86)\reference assemblies\microsoft\framework\.netframework\v4.0\system.core.dll': as 'System::Runtime::CompilerServices::ExtensionAttribute' has already been imported from another assembly 'mscorlib'
1> c:\windows\microsoft.net\framework\v4.0.30319\mscorlib.dll : see declaration of 'System::Runtime::CompilerServices::ExtensionAttribute'
1> first seen type is used; re-order imported assemblies to use the current type
1> This diagnostic occurred while importing type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
1>Lab01.cpp(28): error C2664: 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::get(_Elem &)' : cannot convert parameter 1 from 'char [101]' to 'char &'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I guess it says the error in there but it tells me "build succeeded" for some reason...
Here's how to find and analyze errors reported by Visual Studio:
continue from the last successful build - Click NO (almost always). Errors should show up in the View->Error List. When confused, always check View->Output window after a build, it's a lot of the same info but more detailed.
rebuilding ... same result - A full rebuild should give some other error than project is out of date.
Lab01.cpp(28): error C2664: - Line 28 and 3 lines up and down of Lab01.cpp would be helpful.
Looks like you're doing something with std:: streams that isn't correct, but I don't know what without seeing the code. This should be in the Error List
warning C4945: - This occurs because you're using a mix of .net 4.0 and 4.5 and (possibly) a mix of clr and non-clr code within a single project. Recreating from a new CLR project which has chosen the correct .Net library version everywhere may remove this warning. (ExtensionAttribute got moved during the 4.0 to 4.5 upgrade)
This is just a warning, so shouldn't matter.

C++ 2010 Express Protobuf Compiling Errors

I am having a lot of trouble compiling protobuf source code(2.4.1) for the .lib and .dlls. I followed google's intructions in the readme, word-for-word, but gtest has major errors. Although, I get the libprotobuf.lib, libprotobuf-lite.lib, and libprotoc.lib, does having gtest fail matter? Also, I can compile libprotobuf into a .dll but for libprotobuf-lite.dll, and libprotoc.dll the build fails with errors.
My question: How can I still use protobuf for programing in msvc++ 2010 express. Is there anyone else that implements it?
Thanks.
EDIT:: some build errors ...
1>------ Build started: Project: libprotobuf, Configuration: Debug Win32 ------
2>------ Build started: Project: gtest, Configuration: Debug Win32 ------
3>------ Build started: Project: libprotobuf-lite, Configuration: Debug Win32 ------
2> gtest.cc
3> zero_copy_stream_impl_lite.cc
1> zero_copy_stream_impl_lite.cc
2>c:\users\null\desktop\protobuf-2.4.1\protobuf-2.4.1\gtest\include\gtest\internal\gtest-tuple.h(745): error C3855: 'std::tr1::tuple_element': template parameter '_Idx' is incompatible with the declaration
2>c:\users\null\desktop\protobuf-2.4.1\protobuf-2.4.1\gtest\include\gtest\internal\gtest-tuple.h(757): error C2039: 'type' : is not a member of 'std::tr1::tuple_element'
2> c:\users\null\desktop\protobuf-2.4.1\protobuf-2.4.1\gtest\include\gtest\internal\gtest-tuple.h(742) : see declaration of 'std::tr1::tuple_element'
2>c:\users\null\desktop\protobuf-2.4.1\protobuf-2.4.1\gtest\include\gtest\internal\gtest-tuple.h(757): error C2146: syntax error : missing ',' before identifier 'type'
2>c:\users\null\desktop\protobuf-2.4.1\protobuf-2.4.1\gtest\include\gtest\internal\gtest-tuple.h(757): error C2065: 'type' : undeclared identifier
2>c:\users\null\desktop\protobuf-2.4.1\protobuf-2.4.1\gtest\include\gtest\internal\gtest-tuple.h(761): error C2039: 'type' : is not a member of 'std::tr1::tuple_element'
I had this too. Thanks to jahhaj for the pointer. I tried just changing tuple_element to tuple__element (double underscore) in gtest-tuple.h. It's used 3 times, one of which is in a comment. Everything then compiled fine both in Debug and Release and all the tests ran successfully.
There were a few warnings that came up during the compilation but as far as I could tell they were either deliberate or vagaries of Visual Studio.
Well I can tell you what the problem is, if not the solution. One of the gtest headers is defining a class called std::tr1::tuple_element. MS define a different class with exactly the same name, you can find it in the <utility> header file. I don't see any way to fix this other than to wait for google to do so. It is a problem that has been reported to them.
Alternatively you could download the pre-compiled Windows version
I experienced this problem as well. Since I was using Visual Studio 2010, std::tr1::tuple is actually defined.
Reading a bit in the README file, section Choosing a TR1 Tuple Library, lead me to trying the compiler flag -DGTEST_USE_OWN_TR1_TUPLE=0 or in Visual Studio would simply be GTEST_USE_OWN_TR1_TUPLE=0.
This solved my issue since this tuple is already defined in the TR1 features provided in Visual Studio 2010.

Visual Studio complains that .exe is not found when compiling for debug

I have a very simple C++ application.
#include <stdio.h>
#include <iostream>
int main(int argc, char argv[]) {
cout << "hi" << endl;
}
When I compile for the first time in debug mode, Visual Studio complains "Unable to start program ..\Debug\myprogram.exe. The system cannot find the file specified."
However, I think that this is obvious because I am compiling for the first time, right? This executable should not exist yet, so why is Visual Studio balking at compiling?
Thanks for your help.
Also, when I build, the following log appears:
When I build (Build->Build solution.), this log appears:
1>------ Build started: Project: print_digits, Configuration: Debug Win32 ------
1>Build started 12/23/2011 4:32:17 PM.
1>InitializeBuildStatus:
1> Creating "Debug\print_digits.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>FinalizeBuildStatus:
1> Deleting file "Debug\print_digits.unsuccessfulbuild".
1> Touching "Debug\print_digits.lastbuildstate".
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:00.08
It says build succeeded, but no executable is being built for some reason.
A couple of problems here:
1) This error is about trying to RUN the program, not compile it:
"Unable to start program ..\Debug\myprogram.exe. The system cannot
find the file specified."
2) Probably the reason it can't find the program is because it FAILED to COMPILE.
Here are the errors I got from your source:
tmp.cpp(5) : error C2065: 'cout' : undeclared identifier
tmp.cpp(5) : error C2297: '<<' : illegal, right operand has type 'char [3]'
tmp.cpp(5) : error C2065: 'endl' : undeclared identifier
tmp.cpp(6) : warning C4508: 'main' : function should return a value; 'void' return type assumed
You should be able to fix these particular errors if you add "using namespace std;"
Get a clean compile, and you should be able to run the debugger :)
I had the same Issue. The problem was that my antivirus (in my case Avast) was automatically deleting the file on creation. And because I had Avast on silent mode it did not notice me about the deletion. So disabling the antivirus or setting up a exclusion rule helped in my case.
Need to write after the includes
using namespace std;
I have the same problem with Visual Studio 2015.
If I have a solution with 2 projects and set the Output File in Linker->General to $(IntDir)$(TargetName)$(TargetExt) then it builds an .exe file (I have verified it exists), bit I cannot run it via Visual Studio.
I currently don't have a solution to this problem, other than reverting back to $(OutDir).
The current problem is that both projects produce the object files in $(IntDir) but I get two different .exe files in the same folder.
Once I've tried to change the output location, I've been unable to get the debugger to execute the .exe file through Visual Studio, so I suspect I will need to edit the .sln or .vcxproj files to fix the problem.
Unfortunately Visual Studio is buggy and might require editing the xml files directly in these situations, if these are the problems you are experiencing.
I got a similar error when I didn't declare the libraries I was using correctly in "properties".
I think what I had to do was write the names of the .lib files in Properties/Linker/Input/Additional Dependencies and set the paths in "VC++ Directories". But you shouldn't get that problem with just stdio and iostream.
Same problem had faced, after some RND finally i found the solution.
Solution-Go to project properties->Security Tab->Uncheck "Enable ClickOnce Security settings".