How to save date in a console application c++ [closed] - c++

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.

Related

How to check the dll files required by my c++ file [closed]

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 5 years ago.
Improve this question
I use Visual Studio 2017 Community for C++ coding. I have made a simple win32 console app and do not want to expose my code. I have also found the .exe file in the debug folder of the solution. When I try copying the .exe file in the Debug folder in another folder it says that the dll isn't found.I also tried copying the whole folder but the same error occurs. Please help me...I want to run my app on another computer also.
You can Generate Code Map for Solution.
Navigate to Architecture –> “Generate Code Map for Solution”
Generates a code map like:
Which shows the inter-dependency between modules and libraries.
In your case by just copying the exe, you are breaking the references to all of the required libraries. Depending on your scenario, you have two good options. Copy the entire source tree + dependencies for you project and recompile it in the new working directory or create an installer which will allow you to distribute dlls and any other required resources.
This is more complicated that one might hope. To answer the question in the title, you need Dependency Walker. (The web site doesn't mention Windows 10, but this stuff hasn't changed much recently, so don't worry about that.)
To distribute the program to another machine, you need to create a release build (the debug run-time libraries are not redistributable). Once you have done that, you will almost certainly find that the other machine already has the release run-time library, but you will need to copy other libraries.

How to extract files from C++ program and then run one from them [closed]

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
I'm writing updater program in C++, i need extract files from them.
I'm using Microsoft Visual Studio.
What I'd like the achieve:
User runs exe
exe unpacks files
exe runs one of extracted files
Can anyone recommend a good solution?
Thanks!
Extracting resources from a file with C++:
Extract file from resource in Windows module
Self-Extracting Executable C++
http://www.codeproject.com/Articles/4221/Adding-and-extracting-binary-resources
You're writing an updater.
User runs exe
exe unpacks files
exe runs one of extracted files
So your program should:
Download the patch from the server (use a networking library like winsock or something higher-level)
Unzip the archive (depending on the format in question, there should be libraries for that, like zlib)
Move the new files and overwrite the old ones (use win32 or something higher-level like MFC or Qt)

Trouble with Visual Studio [closed]

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".

Editing this Qt program (C++) I think [closed]

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.

Build a C++ project with debug files [closed]

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 have a Visual Studio solution in C++ containing 27 projects with known build order and everything else, I can successfully build entire solution and everything works fine, As you know after building each project some files will produce in "Debug" (or "release") folder and I access to them for each project, 26 projects of this solution needs no change, I just want to change one project, So I just wondered if I can use produced debug files of all 26 other projects and build my solution again in Visual Studio or any other IDE?
Thank you so much
The 'debug files' of visual studios are *.pdb files and are a proprietary MS format and therefore cannot be used in other IDEs:
What is the structure of a PDB file?
The intermediate files of VS '*.obj' are generated for every translation unit but a conversion to another compiler is not achievable in an easy way:
Is there a tool that can convert a Visual Studio object file to GCC format?
If you already have the VS solution you can make changes to the project you want to edit and VS will ensure that every project that needs a change will be recompiled and linked if you build the solution.
If you want to spare time you can tell VS compile the project you are working on instead the entire solution. You might stay with VS if that works for you.
Adding support for another build-system or IDE should be done by an experienced developer who is familiar with those projects.
In theory, Visual studio will spot what has changed (in a solution) and just saying build should just build what has changed (and its dependencies).
Beware if using the libraries and exes from one compiler with those of another - you almost certainly need to use the same version of Visual Studio, since for example the implementations of the stl will change between version.
Furthermore, if you use a different compiler things will almost certainly go horribly wrong.
If you use another IDE and point it to the same compiler, things should be ok.
edit
If by "another IDE" you mean another instance of the same IDE, i.e. you want to open a different solution, but use this as a "library" that's fine. You don't need the .obj files - they are part of the build process. It's the final .lib or .dll files you need, together with .pdb files if you want the debug symbols.