The system cannot find the file specified in Visual Studio 2013 C++ - c++

I am learning C++ for the first day, went on to type in this code from the first Chapter of "C++ A Beginner's Guide":
#include <iostream>
using namespace std;
int main()
{
cout << "C++ is power prgramming.";
return 0;
}
then when I debug it, I get an error message saying:
"Unable to start program 'F:\Documents\Visual Studio 2013\Projects\Projects1\Debug\Project1.exe'.
The system cannot find the file specified."
The error in output shows:
1>CL : Command line warning D4024: unrecognized source file type '?', object file assumed
1> Microsoft (R) Incremental Linker Version 12.00.31101.0
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> /out:
1> ?.exe
1>LINK : fatal error LNK1146: no argument specified with option '/out:'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I looked though a few posts that seems similar but none of the answers helped me. I had tried to add Additional Library Directories in the properties but still doesn't help. Tried compiling before debugging but still same error came out.
I just installed Visual Studio today so there is not point of restoring Default.
What else can I do?
Thanks very much.

Related

VS2013: fatal error C1001: An internal error has occurred in the compiler

The code is quite simple:
int main(void){
return 0;
}
and the compile error goes:
1>------ Build started: Project: Project1, Configuration: Debug Win32 ------
1> Source.cpp
1>c:\userdata\zdck\documents\visual studio 2013\projects\project1\project1\source.cpp : fatal error C1001: An internal error has occurred in the compiler.
1> (compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\p0io.c', line 2807)
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
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have no driver F but there comes an error in f:\dd\vctools\compiler\cxxfe\sl\p1\c\p0io.c??
Believe in me that I have checked dozens of posts with title "C1001 blah blah..." here and there but no one works for me.
My VS: V2013 Version 12.0.40629.00 Update 5
My OS: win 10, 64 bit
The error C1001 related to compiler file p0io.c is mainly caused by enabling Use Unicode UTF-8 for worldwide language supportin Region Settings. You could see the link about the concrete reason. You could click Time &Language -> Region-> Additional date, time, &regional settings-> Region-> Administrative->Change system locale and turn off UTF-8.
enter image description here
If the error couldn’t be fixed, I suggest that you could update your VS version to VS2019.

Microsoft visual studio: Cannot find file specified

Hi I have been having problems with Microsoft VS.
When I try to run simple code such as:
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
cout << "hello" << endl;
return 0;
}
I get an error message saying:
"Unable to start program 'C:\elevator\Debug\elevator.exe'.'
the system cannot find the file specified"
This message has been coming up for a long time. I do not believe it's any problem with my code. My program will be compiling fine then all of a sudden this error will come up without me even changing the code. I have tried uninstalling and re installing VS which didn't work. I have also spent a long time searching Google for the solution to no avail.
This is the output I get when trying to run the above code:
1>------ Build started: Project: elevator, Configuration: Debug Win32 ------
1>Build started 26/02/2014 14:49:21.
1>InitializeBuildStatus:
1> Touching "Debug\elevator.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.20
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Maybe you have an anti-virus that detects your new program as problematic, and puts it to quarantine as soon as it is compiled.
I think I've found a solution for some C++ projects in vs2010. If you are using 'incremental linking' you will have this "fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt". In my case I've swiched it to "No", and now project compiles and run without any problem.
If you want to try go to: Project Properties -> Configuration Properties -> Linker (General) -> Enable Incremental Linking -> "No (/INCREMENTAL:NO)"
about "Incremental Linking": http://msdn.microsoft.com/en-us/library/4khtbfyf(v=vs.100).aspx

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.

Visual Studio 2010 can't locate <iostream>

I just installed Visual Studio 2010 and I have a feeling something went pretty awry while I was installing it. I have the following code return an error stating that it can't find the <iostream> file. I looked in the includes folder (C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include) and I only saw 4 files (omp.h, pgobootrun.h, srv.h, wmiatlprov.h). I'm not sure if that's normal, but I'm 99% sure it's not.
Here's my code:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, World!";
return 0;
}
Which returns the following errors:
1>------ Build started: Project: Test2, Configuration: Debug Win32 ------
1>Build started 06/11/2012 0:31:05.
1>PrepareForBuild:
1> Creating directory "c:\users\jake\documents\visual studio 2010\Projects\Test2\Debug\".
1>InitializeBuildStatus:
1> Creating "Debug\Test2.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> Test2.cpp
1>c:\users\jake\documents\visual studio 2010\projects\test2\test2\test2.cpp(2): fatal error C1083: Cannot open include file: 'iostream': No such file or directory
1> stdafx.cpp
1>c:\users\jake\documents\visual studio 2010\projects\test2\test2\stdafx.h(10): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
1> Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.65
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
No matter how many Google searches I make I can't figure out how to resolve the issue. Any help is appreciated. If any more detail is needed, I can provide anything required for solving this, thank you.
EDIT 1: I'm not using a precompiled header. I downloaded it from the MSDN website on a page I can't post here because it's tied to the account, but I definitely didn't run out of room (I have around 650 GB free on my hard drive). Yes, I tried re-installing (at least 4 times).
EDIT 2: The page tied to my account was from the Microsoft website. Step-by-step what I did was download the .iso, extract it to a folder with 7zip, run the autorun.exe file, go through with installation (Couldn't have been any errors there, all I did was check the "Privacy Policy" boxes and whatnot), opened up Visual Studio, typed in the code that I have below, and run it. I didn't think that needed any explanation.
I believe that you should try reinstalling or just simply perform a repair in Visual Studio.

C++ Compilation Problems with Microsoft Visual Studios 2010 Beta 1

Well, I just got the new MSVS 2010 Beta 1, and just like with 2008 express, I just can't figure out how to compile anything, not even a simple hello world program. Anyone have any pointers? I usually just get a blanket fail message. No real information.
Edit: Sorry about that
#include <iostream>
using namespace std;
main()
{
cout << "hello world";
return 0;
}
I go to build and I get:
1>------ Build started: Project: forkicks, Configuration: Debug Win32 ------
1>Embedding manifest...
1>.\Debug\forkicks.exe.intermediate.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified.
1>Build log was saved at "file://c:\Users\Randy\Documents\Visual Studio 2008\Projects\forkicks\forkicks\Debug\BuildLog.htm"
1>forkicks - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
That is 2008
1>------ Build started: Project: For Kicks, Configuration: Debug Win32 ------
1>Build started 7/22/2009 9:36:39 PM.
1>_PrepareForBuild:
1> Creating directory "Debug\".
1> Creating "Debug\lastbuild.timestamp" because "AlwaysCreate" was specified.
1>ClCompile:
1> main.cpp
1>c:\users\randy\documents\visual studio 10\projects\for kicks\main.cpp(5): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.63
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
is 2010. I create a win32 project, name it, etc. Right click on source file, add a C++ file with no headers or anything. Just a blank document.
New 2010:
1>------ Build started: Project: hoyeah, Configuration: Debug Win32 ------
1>Build started 7/22/2009 10:03:35 PM.
1>_PrepareForBuild:
1> Creating directory "Debug\".
1> Creating "Debug\lastbuild.timestamp" because "AlwaysCreate" was specified.
1>PrepareForBuild:
1> Creating directory "C:\Users\Randy\Desktop\C++ Programs\hoyeah\Debug\".
1>ClCompile:
1> test.cpp
1>ManifestResourceCompile:
1> Microsoft (R) Windows (R) Resource Compiler Version 6.1.7000.0
1>
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1>
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain#16 referenced in function ___tmainCRTStartup
1>C:\Users\Randy\Desktop\C++ Programs\hoyeah\Debug\hoyeah.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.25
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Edit #2. How exactly would I go about changing it to multibyte?
That's a well known problem with VS10 Beta. You need to change the default encoding to Multibyte from Unicode to make it work.
int main() maybe ?
Try also changing the destination of the project to something simpler and not that long since I believe I also had the same error when the destination was too long.
Also did you choose a console application when creating the project?
If that didn't help, google gave this as possible answers too :
"You could try going to your
project's Properties > Configuration
Properties > Manifest Tool > Input
and Output, and set your "Embed
Manifest" option to "No"."
"I had a similar problem like this a
few months ago and I solved it by
going to project -> properties ->
Configuration Properties -> General
-> Character set. Under character set I changed it to Use Multi-Byte
Character Set and then my compliment
issue went away."
Edit:
In regard to the latest error link here directly from microsoft. I'm afraid that from this point on it's google time as I'm all out of ideas if it doesn't work.
The link says : "As a workaround for Beta1 you can change the entry point to use "wmain" instead of "main" or change the character set of your project to use "Multi-Byte Character Set""
Easiest would be to just change the name of main to wmain then.
Ok, I got it to compile using a win32 console ap, changing to Multibyte, and using the following code:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!";
return 0;
}
Now to try to figure something else out. I'm not used to VS so...
Thanks everyone.