Adding more cpp items in Microsoft Visual C++ 2010 Express - c++

I am using Microsoft Visual C++ 2010 Express and I am having a problem saving more than one cpp item within a solution/project.
When I first create a project I can create a new item, write the code and Debug the program normally. But, when I add a new item into that same project and write the code and try to debug it I get this error:
Unable to start program 'Directory' The system cannot find the file specified.
I checked the directory, the file is there and I can open it but I cannot debug it. I would like someone with experience to help me with this problem. Thank you, I am waiting for answers.
http://i.imgur.com/WD7kGgl.png

The error message is about file Directory.exe. If you don't have that file then there were build errors. See the VC++ Output window for build errors. You have to fix them and then try building again. No exe file is produced if there are any build errors.

Related

How to properly open a Visual Studio project?

I have a problem that will be very simple to solve but I don't know how to do it.
Scenario: I want to run an emulator coded in C++ by a YT (javidx9) in Visual Studio. The project is here: https://github.com/OneLoneCoder/olcNES and the folder is "Part#2 - CPU"
Problem: I never use Visual Studio, so its something new for me, and my problem is that I don't know how to run the project (emulator). And I can't find any post or article on the internet about my problem. (I tried to create an empty project in VS and then copy the emulator files to the folder of my empty project and then run it, but it sent me an error that the files were not found (and its because that isn't the correct way to run the program and I don't know how to do it)).
My request: I would be very grateful if someone could explain to me how to open and run this project (the emulator) correctly in Visual Studio.
Thanks!!!
Your project does not have. sln file. You need to create new project in visual studio. Last file has main function as below. You need to run this main file(olcNes_Video1_6502.cpp)
You may need to check path of headers included from other projects.

WIN32 Application Solution Error: The Project File Could Not be Loaded. Root Element is Missing

I was going to program a game of Snake using SFML, and after downloading SFML, I tried to create a WIN32 Windows Application, and when I clicked finish in the Wizard, I got the following error:
Unable to read the project file "SFML-Snake2.vcxproj".
C:\Users\arnav_1n7er7u\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props(0,0): The project file could not be loaded.
Root element is missing.
This can be seen in the following screenshot, although it may be unclear:
So to try and solve this problem, I went to the appropriate directory and opened the file Microsoft.Cpp.Win32.user.props in Notepad. After doing so, I found something unusual: The file was full of whitespace, and the exact whitespace content was as follows:
Whitespace
(The word whitespace wasn't written there, I just wrote it for the formatting).
In fact, there were two other files in this directory, and when I looked at them, they were also full of whitespace. I have a feeling that is the problem since it is unlikely Microsoft switched to the Whitespace Programming Language, but I have absolutely no idea what is supposed to be in the file. Could I be pointed in the right direction, to see what the problem is, and how to fix the Visual Studio error message so I can create my project?
UPDATE
Ok, to try and fix the problem, I uninstalled Visual Studio 2015, and instead now downloaded the new Visual Studio 2017. In this, I tried to create another WIN32 Windows Application, and got the exact same error, which can be seen as follows:
This time, I tried to open the file Microsoft.Cpp.Win32.user.props and now found this content (For some reason I cannot copy and paste it):
Now I am really confused. For some reason, now I cannot create WIN32 Applications in Visual Studio, whether it is 2015, or 2017. What should I do?
Yes! I figured out how to solve the problem. After reading this MSDN link, I followed the accepted answers idea to delete the files in the directory v4.0. After doing so, I created a new project, and Visual Studio was able to do so because it generated new files in place of the corrupted ones.

Visual Studio not generating debug executable?

I'm currently using Visual Studio 2015 to write a C++ program. Recently I've been getting an error in which the debugger can't locate the executable file generated by the build. I've tried almost every solution out there but I can't fix it. I even tried reinstalling Visual Studio 2015 and it worked for a little while but now I keep getting the same error. It starts happening after I write code for a bit.
I verified that the Linker and the Debug both access the same location for the .exe file. What could cause the .exe file to not generate? My build compiles successfully without error.
Here is the error:
Unable to start program 'c:\users\user\documents\visual studio 2015\Projects\Project1\debug\Project1.exe
EDIT: The only virus scanner I have is MalwareBytes, but this hasn't happened before when I had it installed.
Solved. I was writing my program using a .h file but it needed to be .cpp.

Setting up Root library on Visual Studios Express 2010

I'm trying to incorporate CERN's data analysis libraries, ROOT, in my c++ code.
At the moment i'm using Visual Studio c++ 2010 Express. So far I think i've succeeded in creating a Property Sheet for the ROOT-library, i.e. I can include libraries and complile without getting any errors. The problem rises when I try to start my program. The console gives me the following error:
"Error in : libMathCore.dll does not exist in ... (lots of weird symbols)...or has wrong file extension (.dll)"
I only get the error whenever I include some ROOT-library.
Do any of you know why i get the error, how i fix it or another library for data analysis?
The libMathCore.dll is in the bin directory of your Root installation. You have to copy it to your VS2010 project or your System file.

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)