How do I load a folder containing all of the codes for a program into visual studio basic? - c++

I'm an intern working on a machine learning program. While I have learned C++, I have no experience actually making programs or loading existing ones.
The code files were shared to me via one folder.
https://i.imgur.com/S2iOMoM.png
The circled folder consists of these files:
https://i.imgur.com/RlVGWb6.png
As you can see, a lot of cpp files. There's an hpp file not shown in the image. A compiled exe is also included
I have Visual Studio (2017). My job is to load the project, make a change to a variable, recompile and then use that exe to complete a simple job.
However, when I load the folder into Visual Studio, I am not able to rebuild/compile the code.
https://i.imgur.com/VOwKxk7.png
How do I load the code so that I can rebuild and compile a new exe?

Related

make visual studio add all necessary when building release

So I am working on an example project that displays video from a network stream.
The project is in C++.
After building the project in release, and trying to run the project on a different computer, I get errors on missing DLL files.
These DLL files are located within the installation location of Visual studio.
one example is msvcp140d.dll.
After copying all the missing files, I get a generic error with no specific file.
So:
Is there a way to tell visual studio to add all relevant files when building the project?

What cpp file types can I delete/exclude when packaging into an install bundle?

I want to package my executable file and other needed files into an install file (using NSIS) so that other people can install and use. There are a few file types I am uncertain of whether they are needed for installation or if it is safe to delete them.
Here is a random example of the files in the project folder as well as the Debug file automatically generated by VS:
I have already deleted the .user file as I know that is not needed, but not sure when it comes to .vcxproj, .tlog, .build.cppclean, .idp, and .pdb files. Also, do I need to keep the .obj files as well as the .cpp files?
This is my first time trying to do this, I am just messing around to seeing how it all works so thanks in advance.
You generally only need the .exe. Your app might depend on custom .dlls or the C++ run-time library in which case you would bundle the custom .dlls and/or the C++ redistributable.
Your screen shots are of a debug build and you normally want to distribute a release build instead because it is often smaller and contains more optimized code.
.obj files contain the machine code for each source file and is used by the linker when it merges all the required code into your .exe.
.pdb files contain debugging information. You should not distribute them but it is helpful to store them for yourself in case you need to debug a released version of your application.
The rest of the files in Debug and Release can also be ignored.
If your project is open source then you could include the c/c++ files and the Visual Studio project files. Or you could just upload them to Github.
In NSIS you could do something like this
InstallDir $ProgramFiles\MyApp
Page Directory
Page InstFiles
Section
SetOutPath $InstDir
File myproject\Release\MyApp.exe
File mylibrary\Release\*.dll
SectionEnd
It is a good idea to test your installer on a freshly installed Windows instance. Ideally the minimal version you require, Windows 7 etc. This should allow you to verify that you have included all the files required by your application.

How do I debug existing C++ source code in Visual Studio 2015?

This may have a very simple solution, but being new to Visual Studio and C++ programming, I'm having a hard time with this.
I downloaded an SDK written in C++ which contains an executable file and also the source and header files. The executable file accepts some command line arguments. So far I've been running the executable file from the windows command prompt (like C:\path\filename.exe -argument), but now I want to be able to enter these command line arguments and then place breakpoints in the source code for debugging the source code.
I don't know how I can open the source files in Visual Studio and debug it. If I just open the source file with the main function, the debug button says 'Attach' on it instead of debug.
I see another similar question here, but that question is for a project developed using Visual Studio whereas the source code I have does not have any Visual Studio project/solution files. The only files I have are the executable, the source and header files (.cpp, .h, .hpp), and CMakeLists.txt files.
You can "open" the exe as a project (you can achieve the same if you drag and drop the exe into VS icon). Then you can add command line parameters at Project Properties. You will need to have debug symbol information (usually a .pdb file), if you want source code level debugging (values of variables, etc.). If you don't have that, you can only debug at the disassembly level.
You may want to create a proper project for the source files - it is an easy task, if the project is simple - so you can rebuild the exe.

Program works in VS 2013 but not the .exe

I have made a test program in Visual Studio 2013 using Direct X 11. It consists of a simple sprite which rotates slowly based on a timer implementation. The program loads and runs fine using F5 or Ctrl-F5, but when I try to open the actual created .exe (in my \Debug folder) it just shows the window then closes instantly.
Most of the answers I have read on this issue correspond to loading the .exe from inside visual studio. I have also tried Release mode but the same thing happens.
Sprite files are kept in your project folder. The default run-location from the Visual Studio IDE is the project folder of the project which you're executing. That is, normally it executes from the directory where your .vcproj or .vcprojx file is kept (and that is often one folder below your solution directory folder, where your .sln file is kept).
If your project runs correctly from the IDE, but fails to run directly from the debug folder, it is highly likely you are relying on project data files that are kept along side your source files in the project folder. When run from the Debug folder, those files are no longer visible because Debug folder is your working directory; not the project folder.
There are a number of ways to solve this problem, each with its own merits. A few options are:
Post Build Step
Make a post-build step for your project that copies your data files to the $(TargetDir) location with your project. These files will then be visible in the same directory as your executable.
Benefit: Its easy.
Drawback: It will always run if you click "build solution" even if the data files are "up-to-date."
Custom Build Targets
Add your data files to the project and write a Custom Build script that performs the same copy, but also establishes an output dependency file(s).
Benefit: Almost as easy as #1, but a little more tedious.
Drawback: You may have a lot of data files and each will require its own custom build step. (Note: you can multi-select all the data files in your project, and if you're creative with the built-in macros you can have them all use the "same" build rules and commands).
Embedded Resources
Add the data files as custom resources to your executable.
Benefit: Your project no longer requires data files side-by-side with the executable since they are embedded in the resource table of your EXE module.
Drawback: Custom code is required to dynamically load the custom resources from your executable's resource table rather than off-disk. It isn't difficult at all to do, but is additional work.
There are other options as well, but I hope this gives you some ideas to start with.

Build project package C++ Builder

I have written a GUI forms application in C++ Builder and am wanting to be able to run the .exe on another computer.
I am getting some .bpl errors when trying to run the .exe on another computer.
How can I combine all the required files into a 'package' such that the .exe can be run on computers that do not have the required files?
I have done Project->Deployment and a list of files have appeared, including the .bpl file. However, what do I do from here?
thanks
Your .exe has dependancies on external .bpl files that you have not distributed to the other machines. If you want the .exe to be self-contained so you do not need to distribute those files, go in to the Project Options and disable both the "Use dynamic RTL" and "Build with runtime packages" options.