Hello,
Thank you for reading my post.
My problem is about missing DLLs when running a program generated using "Code::Blocks".
I have created a new "Console application" project with "Code::Blocks":
"File" -> "New" -> "Project..."
"Console application"
"C++"
"Project title: foo"
"Compiler: GNU GCC Compiler"
I opened "main.cpp" and edited the following code:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
cout << "Entering the program." << endl;
ofstream myfile;
myfile.open("C:\somewhere\in\the\filesystem\foo.txt");
myfile << "Writing this to a file.\n";
myfile.close();
cout << "File opened, written and closed." << endl;
return 0;
}
1) If I build the program: it builds properly.
2) If I go to "C:\where\codeblocks\projects\reside\foo\bin\Debug\" and double click the program "foo.exe": it executes properly.
3) Now if I:
- copy "foo.exe" somewhere else in the filesystem (in "C:\somewhere\in\the\filesystem_2\"),
- go to this directory,
- and run the program,
I get the following message:
The application has failed to start because libgcc_s_dw2-1.dll wasn't found. Re-installing the application may fix the problem.
4) If I add the path "C:\MinGW\bin\" - where "libgcc_s_dw2-1.dll" (and also "libstdc++-6.dll") can be found - to the "Path" environment variable and run the program again: it works properly.
So, my question is the following: is it possible to create a "Code::Blocks" project / configure a "Code::Blocks" project / build a "Code::Project" so that wherever we put the program "foo.exe" in the filesystem (including on another computer), it executes properly with no missing DLLs messages?
Thank you for helping and best regards,
--
Léa
=====================================================================
OS = WinXP
Code::Blocks version = svn build rev 7550 - SDK version = 1.11.16
C++ compiler = mingw32-g++.exe
Linker for dynamic libs = mingw32-g++.exe
Linker for static libs = ar.exe
=====================================================================