Build project package C++ Builder - c++

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.

Related

How to make my CPP console app installable/redistributable which depends on some external files?

I am new to this coding world. So forgive me if any dumb question is asked or I made any mistakes
I am making a cpp tool which works well on my machine & also on others too. But inside it there is a function which works with some BAT & VBS files stored in a separate folder. Now the problem is when I am sharing the EXE file it is not working as the folder directory can not be found on other devices.
Now how can i solve this scenario? Is there a way to make installer for the console app which will copy the necessary files and folders in to the user's C drive? Or can I include the files into the EXE and extract them to a folder so the the program can use those?
Is there any possible solution for this ?
I am using Visual Studio Code & mingw gcc compiler for building the app
How about creating installer using setup creator(https://installforge.net). You can package multiple files in the installer and select installation directory to something like c:/program files/your_application_name.
That way your executable and other files will be in the same folder and it will also create a start menu shortcut
One straightforward solution I can think of is to include the dependency files with the exe when you share it to others.
Another way is to embed the dependency files as resource files into your executable when you build it in Visual Studio, then extract them when you run the exe (A little difficult to implement)
Or just create an installer like this

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.

NetBeans 8.0.2 "no executable specified in project"

I am working on a c++ application and it builds just fine but upon running my main class NetBeans complains that no executable has been specified in my project, it then asks me to provide a path to a .exe file? What is an executable and where can I find it?
An executable is a file that can be executed. A .exe file is one kind of executable. In general some people would include .bat files, .com files, .jar files with a main class in the manifest, scripts in various languages etc as executable files. In Linux/MAC executable files often have no extension at all.
However, if you are on Windows building with C++ the file you probably want is a .exe file.
If you create a new C++ Application type project it should already know which file to run since it will be setup to create it. If you create a project with C++ Project with Existing Sources then the project could create multiple executable files or none at all if the goal was just to build a library. This depends on who ever authored the external Makefile or whatever that project uses. If you don't know and can't guess from looking at the directory ask whoever created the original project or consult their documentation.

visual studio 2013 deploy a project

I crack my head already, I need to deploy a project. I tried to use InstallShield, it create an msi file, and local installation has no errors, but then when I tried to launch the program it output "debug error". In my settings code generator -> runtime library set for Multi-threaded Debug DLL(/MDd). If I'll set it to Multi-threaded (/MT) it would not compile: "Please use the /MD switch for _AFXDLL builds"
Then I tried to use VS Installer project extension. It creates the msi and setup file, but after I install it, I can't find the .exe file and launch program. What I am doing wrong?
Folder with project files
![enter image description here][3]
Folder with exe file
![enter image description here][4]
At the stage of creating the installer for your program, you have to put all the external files, libraries and resources, that your program needs in order to run correctly, in your program's working directory. When you run the program via Visual Studio, everything works fine since it can find the files, because, as you've mentioned, they are in the project folder, and the project folder is where Visual Studio is looking for them.
When you launch your program outside VS, the program can't find these files since it by default tries to locate them in the folder in which the .exe file being run is located. So, if you wan't to run program outside VS, you need to put all the files needed to your .exe's directory.
For the same reason, while creating your installer, you need to include all the files necessary in the installation target directory together with your .exe. Every installer creator lets you do that.
In general, if you cannot run your program outside any IDE, and you can run it within that IDE, it is a rule of thumb that you should first check if you have included all the necessary files/libraries/dll's/etc. in your program's working directory.
I solved it!!!!!!!!
1)Help to run .exe file, helped updating .uld file in the same directory as a exe file.
2)I used Dependency Walker (http://www.dependencywalker.com/) to find all dll that it's need. And then I create a Setup Project using Wizard at the "Choose file to include" step I add every file and every library that it's depend on! Build->Install-> Then magic, and my application installed and running! Thank you all for your help

c++ executable program test

I have been following some tutorials for c++ game programing. I am kind of new to c++ and I'm using Microsoft Visual C++ 2010 Express IDE. I'm working on creating a game, and when I run the program through the IDE, it shows the grass sprites as expected. But when I run the .exe file from the Release folder, it shows weird images. and when I run the .exe file from the debug folder I get a grey screen. Can anybody tell me why this is happening?
I hazard to guess that your sprite images are kept as data files in your project folder. With that I offer the following premise:
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 release folder, it is highly likely you are relying on project data files (images in your case) that are kept along side your source files in the project folder. When run from the Release folder, those files are no longer visible because your the Release 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.
I use VS2008 and try to answer your question. Right click on the project and select properties on the bottom of popup, then go to Debugging under Configuration properties. You can see command you run and arguments you pass in IDE. I guess you miss some parameters.