User forums > Using Code::Blocks

[SOLVED] C::B 13.12 -static not working

(1/7) > >>

dcbdbis:
Good Morning All,

I have haunted this site, the GNU-GCC site, and other google/yahoo search results. I am using C:B 13.12 with the included MinGW suite under Windows -7. The wxWidgets lib (2.8.12) has been built from scratch following the article on the C::B wiki. The flags for the wxWidgets build was per the C::B wiki article found here: http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef. I did alter the flags, the flags I built with were: mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=0 CXXFLAGS=-fno-keep-inline-dllexport where I changed the Unicode flag to "0".

I also use FreeBSD and have a second drive where I dual-boot Windows-7 for developing Windows ports. Under FreeBSD I am having no issues of any kind. C::B operates perfectly. It is a great RAD environment. Windows however is causing me issues. Under Windows, I cannot obtain a statically linked .exe file. This is where my problem comes in. The resulting executable still requires the custom dll file to run. They run fine in debug and release builds as long as this dll is in the respective debug and release folders....But I want a static link.

In my linker settings I have "C:\wxWidgets-2.8.12\lib\gcc_dll\libwxmsw28.a" for Windows (minus the quotation marks) and then in the Other Linker Options I have "-static" (minus the quotes). I am building ANSI code, not unicode under Windows.

I've found multiple posts about reading the GCC docs. I have done so for the last 4 days. "-static" is supposed to result in a static link for GCC based compilers. It isn't in my case.

I am suspecting that I am putting the "-static" flag in the wrong location under C::B.

Can someone please enlighten me where to pass the "-static" flag to the linker if not where it is already?

And if I am configured properly....can someone assist in a workaround so I can generate statically linked exe's under Windows?

Also, if I am configured improperly....can someone please post an exact "HowTo" guide to configure C::B for static linking under Windows-7? I ask for the "HowTo" if I am configured improperly because there are no clear, succinct answers in the searches that I have conducted here, and elsewhere. So we might as well post it to prevent more posts like mine about static linking.

If I have missed this post somehow in my searches, I apologize, and would simply appreciate a link to the relevant post(s) for configuring C::B for static linking under WIndows-7.


Thank you for any assistance.


Sincerely and respectfully,

Dave


Edit: In reviewing the build messages. I can see the "-static" flag being passed.

I am building the same app under FreeBSD, Linux, Windows, and then a java version for web deployment for a client of mine. C::B under FreeBSD/Linux is working perfectly. My issue is specific to using C::B under native Windows-7.

stahta01:
What custom dll file to run are you talking about?
Post the filename!

If you mean the wxWidgets DLL, you need to have a static wxWidgets library to link to it.

Shared=1 means build DLL.

Tim S.

dcbdbis:
Thank you for your reply.

I do understand what the shared flag means. When I built with "SHARED=0", and since "-static" isn't working, I was unable to debug the source code ported over from FreeBSD. So I rebuilt the libraries with the "SHARED=1" flag so I could at least work.

The dll file that has to be in my "\bin\debug" and "\bin\release" folders to run the code is named "wxmsw28_gcc_custom.dll"

If I can solve the "-static" problem...I will rebuild the libraries with "SHARED=0".


Thank you for your assistance,


Sincerely and respectfully,

Dave

PS: Old Fart here. Been coding since 1973. 1st code and subsequent code for 15 years was written in assembler.  The early Building Automation Systems I supported, were all done in assembler. (motorola 8-bit CPU's)
When I got started....Think ENIAC and 150 baud acoustically coupled modems is how I cut my programming teeth. Green Punch cards.... I am not new to coding, I am relatively new to the C::B IDE/RAD.

ToApolytoXaos:
I would suggest doing what I did and have found my peace for good.

I have downloaded the following file wxBuild_wxWidgets, tweaked it a bit to point to MinGW (TDM's GCC to be more precise), and compiled my wxMSW-2.8.12 just fine.

dcbdbis:
Dear ToApolytoXaos,

Thank you for your reply,

I have compiled wxWidgets just fine. It's not a wxWidgets issue. It's where/how to tell C::B to statically link my "libwxmsw28.a" into my project, other than the "-static" flag which I am already passing to C::B.

Thanks anyway though.


Sincerely and respectfully,

Dave

Navigation

[0] Message Index

[#] Next page

Go to full version