Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Ok, so I create a project.
Now I create two c++ classes in that project A and B.
A has some compilation errors. B is just fine and compiles fine.
Now, when I run B, it wouldn't run because A still has compilation errors.
So, I don't like to create a whole new project just because I want to create a new c++ file (scratch to experiment on) and toggle between the two projects.
Is there any way I can just have two c++ files existing independently in a single project?
In the current scenario, how do i build/compile and run only one of the c++ file (A or B) without the other one getting compiled and run as well.
This is why I never made the transition from sublime to VS.
First Question: In Visual Studio, in your Solution Explorer, right click under your project and select "Add>New Item" and then select your code file format in the Window that pops up(C++ in your case). Enter a name for the file and then click the "Add" button.
Second Question: In the solution explorer window, right click the file that you do not wish to be included in the project and select "Exclude from Project". That file will not be compiled, but will still be visible in Visual Studio. When you want to include the file, same procedure: Right click the file, select "Include in project".
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have downloaded a source code and can't get my head around to how can I compile it/open it in VS 2017. It should have been straight forward but nothing worked until you create a new project. If I just open a C file in VS, it just show me the file and there's no way to run it. Imagine I wrote a simple Hello World in C and I have its C file. How could I open and run it in VS? The only way I found was to create a new project and copy/paste the code from my C file into the newly generated file by VS. This gets extremely inefficient with large projects having multiple C/h files :/
Yes, you should Create a New project -> Visual C++ -> Empty Project. After that, you will see in the solution explorer (Resource files, Header files, and Source files) folders. Right click on Header files and Then Add -> Add existing items, Then you can select multiple header files. Follow for source files same as header files that you Added
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
When creating a new C++ Windows Application in Visual Studio 2017, I am always given an stdafx.cpp file, as well as stdafx.h and targetver.h files. I am taking an Intro Programming class and the instructor thoroughly disapproves of these files being included in our projects. I am using a Mac with BootCamp to run this compiler properly, and I am able to write my code and run it fine - but I need to get rid of these extraneous files that are included with my project.
My professor's suggestion was to instead create an Empty Project when initially making the project, but this must leave out some type of necessary libraries/headers because my same code will misbehave with functions like "cout". (builds fine).
Put simply, how can I create a new project that is empty besides my cpp file, and behaves as normal?
You can create a new project and disable use of of precompiled headers and please also select Empty Project while creating. If you don't intend to create a new project file, you can do this in the existing project file.To do this, do the following -
Select your project, use the "Project -> Properties" menu and go to
the "Configuration Properties -> C/C++ -> Precompiled Headers"
section, then change the "Precompiled Header" setting to "Not Using
Precompiled Headers" option.
when you create a project with visual studio ,you'll have the option "use pre compiled headers" which you can disable !
NB Just discovered that the new update (15.3.5) of vs2017 has changed the creation of projects a little and seems to offer this only when choosing Windows desktop wizard !
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
When you make a C++ console application on VisualStudio for example, when you use your application and you quit it, I think the data is lost is that right? Is there a way to not lose the data and make an .exe from the console project to have a program that you can open, close, open and modify the data?
When you use your application in Visual Studio it first creates an executable file, an exe file. The C++ file is compiled and linked. The compiling and linking is called a build.
At the bottom of Visual Studio you will see an "Output" window. Errors will appear there if there are any. If there are not errors then you will see a line similar to the following.
1> SO36972615.vcxproj -> c:\users\sam\documents\visual studio 2015\Projects\SO36972615\Debug\SO36972615.exe
Here, "SO36972615" is the project name. The project is at:
c:\users\sam\documents\visual studio 2015\Projects\SO36972615
The project files are in that directory. There is a "Debug" subdirectory with an exe file in it, SO36972615.exe. You can execute that file outside of VS. You can also copy it to some other place in your system.
To use your program in another system, you will probably need to do what is called a Release build. You need to learn about that too. If you do a Release build then you might be able to just copy your exe file to another system.
You probably need a setup system to install your program into another system. A setup is also called a deployment and programmers often say they need to deploy their software. Learning how to deploy (create a setup for) your program will take time but that is how you would be able to use your program in other systems.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am working on a raspberry pi project that I have picked up from a previous groups work.
It seems that the program used to control the raspberry pi has been compiled and we can run it fine, however there is no original source code (C++) or any project files for Qt as far as I can see, below is a copy of the folder, is there any way to get at the source code using Qt or something else?
We want to be able to make changes to the program.
There is no documentation on the build of the software, only indication on how to run it which we can do fine, I am trying to track down the authors but to no luck.
What can I try? I tried opening the files here with http://codelite.org/.
All of the object files and the turbo_gui file just contain one line: ELF SOH SOH SOH
On the image you posted, the directory is a Qt build directory, not a source directory.
The folder you showed contains some source files automatically generated by Qt, some compiled .o files and a linked binary, but not the original source code.
If the authors didn't publish the original C++ source code, there is no way to get the exact source code back. You should ask the authors to send you a copy of the source code.
If there is no way to get the source code, the best you can do is use a disassembler or decompiler (such as Hex-Ray's plugin for IDA) to get an idea of how the code works, then reimplement it yourself.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I cannot press F5 to debug my program, because there is only an Attach... button instead of a Debug button.
I am using a .c source file, and I was able to debug my sources until I changed a .cpp to a .c and now every source file I open, it says "Attach...". What do I do?
Try menu Tools → Customize → Commands → Add command...[button] → Debug (under Categories). Find and add the button you would like to.
Also try setting your project to startup one - in Solution Explorer - right click on the project and choose the Set as Startup project option.