How to compile a program in wxSmith ( Codeblocks ) with all the libraries? - c++

I have created a program in Codeblocks (wxWidgets Application) I have compiled it and it runs perfectly when executed from the codeblocks interface ....however when i go into the release folder and run the executable it gives me *.dll file errors :/
How do i make the program ?

There's a good chance that Code:Blocks has a default setting for the executable path that includes the path to the libraries. As Windows finds the DLLs using the PATH environment variable this will ensure that your application works inside CodeBlocks.
However in order to run it outside CodeBlocks you'd need to either copy all the dependencies into the directory that holds your application or you'll have to set your PATH variable to include the directories that hold the dependencies.

Related

Qt Creator can't find library files in the search path

When I compile the release target, everything is built correctly and I can run the program via windows explorer (the install script copies all the libraries to the .exe folder).
The problem that I am having, is that the program does not run inside QtCreator (in both debug and release) unless I manually copy the libraries to the .exe folder. This was not how it used to work but somehow, since I upgraded to Qt6 and start to use mingw instead of vc++, this behaviour started to happen.
There is an option in the project tab to "Add build library search to the PATH" that apparently is intended for exactly this reason (sip copying the libraries every time we compile), but somehow this is not working. I see the PATH change in the Environment form, but the program just crashes on loading with a "This application was unable to start correctly". If I copy the libraries and try again, it works.
So it turns out that it can't find just the onnxruntime.dll library. I assume that it has trouble finding any library that does not start with lib from the path. My solution for now was to copy just this file to the .exe folder.

Copy MinGW w64 runtime dlls to the target directory under Windows using CMake

I am trying to use CLion + MinGW to develop an application on Windows.
The program can be compiled and run normally, but when I enter the cmake-build-debug folder to run the program alone, the program reports an error that the runtime dynamic library is missing.
When I manually copied these dll files from the mingw/bin folder, the program can run normally.
Files:
libatomic-1.dll, libgcc_s_seh-1.dll, libgomp-1.dll, libssp-0.dll, libstdc++-6.dll, libwinpthread-1.dll
However, it is very troublesome to manually copy these files every time. I would like to ask if there is any way to automatically copy these files
I know there are add_custom_command statements that can help me copy files, but I can't get the path to those DLLs
If you know the location of the DLLs you want to copy over you can use the CMake file function. If the DLLs happen to be where the C++ compiler is located you can use this example to locate the libatomic-1.dll .
file( COPY "${CMAKE_CXX_COMPILER}/libatomic-1.dll" DESTINATION "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/" )
This will copy the file libatomic-1.dll to the directory specified by ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/
And it will save you from performing this task manually.
If you're unsure where the file will be and want to search for it, then the CMake function find_path can search a series of directories for you and return a file's path.

Program runs after building but not when executed from Release/program.exe

So I've configured a solution on VS 2013. I'm linking OpenGL, GLEW and GLFW3.
When I hit ctrl+f5 to build/run the release version it goes without errors, the program runs correctly after building.
However, after that when I try to manually execute the program using the .exe file created inside the Release folder it crashes.
Anyone has any clue on what can be the problem?
Place your DLLs + media inside the release folder (under bin)
Does the exe have all the files it needs in the Release folder? The working directory that is used when you run from VS and the one when you double click the exe are probably different.
MSVC's built-in debugger is configured to use a different working directory when you start your software than the actual location of the .exe file.
Often it is configured to use the project's base directory. If your DLLs and other resources that are loaded relative to the working directory at run-time are installed in that directory, then this is why it runs fine from the debugger but not when you launch it with a working directory of: "Release".
Often as a final step in the build process well-designed projects are configured to move/copy the .exe to a much more reasonable location than "Release" for deployment.

Export executable program from QtCreator

I want to export an executable program from Qtcreator, the program works fine inside the Qtcreator but outside I got an error message, "missing QT5CORED.DLL" so I add it to the binary file but it keeps asking for other dependencies.
You need to put that dll in the executable folder. The dll would be in the Qt folder i assume, check it.
Also please note that is a debug dll (the last D in the name), you‘d want to ship a release build instead of a debug one.
You can find necessary QT dll's in: QT Directory \mingw48_32\bin
and windows runtime dll's in: QT Directory \mingw48_32\plugins\platforms
path is for mingw compiler

MinGW Compilation Problem

I just installed MinGW using the automatic installer MinGW-get-inst that I found on their website. I am using eclipse to write my C++ programs. My code compiles fine, and I get a .exe file. However, when I try to open this executable, I get the error that libgcc_s_dw2-1.dll is missing from my computer. I have located this file under MinGW\bin so I know it exists.
This is for all C/C++ programs, I am testing with a simple hello-world program. Any fixes?
Thanks
You need to ensure that the MinGW\bin directory is on the path from where you are running application.
If you were running the resulting executable, say a.exe for example, from a CMD window do the following to check that MinGW\bin is on the path.
set PATH
At this point you will see the current value for the command path. Make sure the MinGW\bin directory is in it somewhere.