Executable error : Can't start program - c++

After finishing my C++ program (on windows os using codeblocks)(using libcurl) when i try to launch the program from the executable it displays an error saying that i can't start the program because libcurldll is missing,reinstall program then retry. I don't think any line of code is needed here,it's just a configuration and logics problem,any ideas,would be great !
Please note that,running it from the codeblocks's console works fine.

Common issue with DLLs or SOs is that the executable needs to know where they are.
A common solution is to place the DLL library in the same folder as the executable:
Find the libcurldll file.
Find the folder containing your executable.
Copy the libcurldll file into the folder containing your executable.

Related

System error - "the code cannot proceed because .dll was not found."

I'm getting this error when I try to run my app:
I checked and there is no reason that I can see that it wouldn't be able to find libnlopt-0.dll. Here it is (note GlassModelCalcualator is the DLL that uses libnlopt-0.dll), in the GlassModelCalcualatorDLL folder:
and in the debug folder of GlassModelCalcualatorDLL:
I have a different program that has a console which uses GlassModelCalcualator.dll and that also has this issue. To fix that, I had to put libnlopt-0.dll in the Debug folder of GlassModelCalcualator.
I'm assuming this is not the same problem here since you can clearly see that libnlopt-0.dll is in GlassModelCalcualator's Debug folder.
Any ideas?
Windows will follow a hierarchical order when searching for dll's.
You could place your dll in the same directory as the exe or even in the Windows system folders (only if you're absolutely sure you want to keep this dll forever as there's no cleanup)
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx

opening an exe file in c++ form

i am implementing an installtion program for my program , i am using c++, QT in debug mode , everything went well till the final stage (run the program after installation)
i tried these two ways for opening the exe file:
QString program= "example.exe";
method 1:
QDesktopServices::openUrl(QUrl("file:///"+program,QUrl::TolerantMode));
method 2:
QProcess::startDetached(program);
but it gives me that error message.
Possible some of application components not founded by executable file. For simple case QProcess::setWorkingDirectory( /* executable directory */ ) can help.
In bad case check environment variables of process in your run. You can loss paths to required libraries.

missing libnoise.dll prevents program from running

I have made a project and linked the libnoise library to it, it runs fine when I include the files but as soon as I run this bit of code -
noise::module::Perlin myModule;
double value = myModule.GetValue (14.50, 20.25, 75.75);
std::cout << value << std::endl;
it throws me this error:
the program can't start because libnoise.dll is missing from your computer. Try re installing the program to fix this problem.
I already have the .dll in the same folder as the .exe and it should be linked correctly.
thanks in advance.
I say you were using Visual Studio. The IDE has the concept of 'working directory', which happens to be the directory the loader starts looking for dynamic libraries your executable might depend on.
Properly setting the WD to the directory in which the executable gets generated is the way to go.

Trouble with OpenCv in code blocks

I have followed the official guide for setting up OpenCv in codeblocks.I did everything as in the guide.I succeded to compile one code of the samples of opencv but when I run I have an error that some .dll is missing.More precisely this is the error:The application can't start because libopencv_core242.dll is missing from your computer..Try reinstaling the application...The awkward thing is that this static library is present in the bin folder under build->x64->mingw->bin..
Any help would be appreciated.
Try to copy the dll into the folder containing the executable.
For a "cleaner" solution, it has been answered here (with libgcc) : The program can't start because libgcc_s_dw2-1.dll is missing
Basically, either you copy the dll containing folder into the PATH ENV, or you can try to link with the statically.

c++ boost library cannot open file

I tried to work with the boost library to read/write configuration files but I just don't get it.
I even can't run the example code from boost.org (5 Minute Tutorial)
http://www.boost.org/doc/libs/1_49_0/libs/property_tree/examples/debug_settings.cpp
I've downloaded the boost_1_49_0.zip package and unzipped it to my c++ program folder. The code compiles (TheIDE - U++) but it always says "Error: debug_settings.xml: cannot open file" which basically means that the program works, but runs into the exception.
I didn't change the code, I just copy and pasted it to get a working example which I could try to understand then. But I don't even get this one to work. (Since it's exactly the same as in the link, I don't paste the code here... unless you think it's better.)
Please help me... or point to a different way to store variables in a file with some kind of structure (I wan't to learn a way that works for windows and linux, because some of my apps are cross-platform.)
Thanks.
EDIT: debug_settings.xml is in the same folder as the .cpp file
EDIT2: Working now, the debug_settings.xml is now in the folder where the executable is stored. (in my case, U++/TheIDE it's C:\upp\out\MyApps\MINGW.Debug.Debug_Full.Sse2 for debugging)
The configuration file would need to be in the working directory of the executable when it's running.