User forums > Using Code::Blocks
Problem with standalone exe
(1/1)
bad_terminal:
Good evening,
So I've been using CodeBlocks for a number of years while attempting to learn C++. However, after a recent re-installation of 20.03, I noticed that while my programs compile in the editor, the exe's they produce are smaller than usual (215kb v 2487kb), and the standalone exe will not run.
If my understaniding is correct, it's because certain compiler flags weren't set.
Now, whilst I appear to have remedied this, what would cause this to happen? Are those flags not set as default with a fresh installation? I installed 20.03 the first time so long I don't remember having to set flags.
For anyone else having the same problem , the flags I had to set were -static -static-libgcc -static-libstdc++ in the compiler flags section
Also, in the global compiler section. there are numerous things to 'set' eg, C++ compiler , linker for dynamic libs, linker for static libs, resource compiler, make program.
I've set all these to x86_64-w64-mingw32-g++.exe, but really have no idea what any of them are meant to be set to, and/or what the effects of using different (but similarly named) compliers would have.
Please advise.
Thankyou.
So several days and no replies? A veritable hive of activity! Surely somebody knows what all those different 'compliers' are and what the difference is?
gd_on:
have a look to https://stackoverflow.com/questions/1993390/static-linking-vs-dynamic-linking
And add in your PATH system variable, the path to "your compiler\bin" sub-folder (where is located your gcc.exe or g++.exe) : may be something like C:\MinGW64\bin or C:\Program Files\CodeBlocks\MinGW\bin or something else. Code::Blocks, for its own usage, know that path. Bur for a standalone executable, build dynamically (with dlls) you have to help a little bits Windows.
Navigation
[0] Message Index
Go to full version