Code::Blocks

User forums => Using Code::Blocks => Topic started by: barbarello on February 13, 2006, 11:10:42 am

Title: [RESOLVED] Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: barbarello on February 13, 2006, 11:10:42 am
Hi

I compile wxWidgets with parameters SHARED=0.
So the folder created is gcc_msw

My compiler is mingw and my IDE Codeblocks.

I cannot compile due many errors
I don't know what are parameters to add.

If someone compile wxWidgets with SHARED=0, can he give me linker and compiler parameters ?
It will be nice..

I've post this before on wxWidgets Forum, but no response, so i try here.

Thanks
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: mandrav on February 13, 2006, 11:13:07 am
Instead of posting, you should use this little search box in the upper right part of the screen. It has been answered so many times...
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: barbarello on February 13, 2006, 12:03:52 pm
That's right, that's what i've done.

And It's not the first time that i've post this question.

Each time I've found link option to lib\gcc_dll\msw but after compiling, the folder name is gcc_msw.
If I link to, i got errors.

I don't understand anything about thoses parameters, I made test without understanding what I do....

If you prefer delete this post, it doesn't matter I still looking for solution with searching tools.  :)

Thanks for your reply
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: Michael on February 13, 2006, 12:15:04 pm
Hello,

You can have a look at:


And I am quite sure that in wxWidgets package/website there are information on how to build and about the different parameters.

Best wishes,
Michael
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: barbarello on February 13, 2006, 12:36:17 pm
You are really great.

Unfortunatly thoses options are for SHARED=1 and gcc_dll folder.
After compiling I don't have gcc_dll folder...
In first time, I've read wiki codeblocks and wxwidgets (compile with SHARED=1) to use with CodeBlocks and it works fine.

However I need to copy each time wxmsw26_gcc_cb.dll (6 Mo) and mingwm10.dll with my exe (weight under 300Ko...)

So i decided to generate only 1 executable (without dll) even this option will increase his weight.

Since the recompilation of wxWidgets, I can do anything via Codeblocks.

Maybe this post have not his place here.

I 'm going still search by my side.

Thanks for your reply
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: Michael on February 13, 2006, 12:44:34 pm
However I need to copy each time wxmsw26_gcc_cb.dll (6 Mo) and mingwm10.dll with my exe (weight under 300Ko...)

You can build a static wxWidgets library, instead of dynamic. Then you can distribute your .exe without including the dll. Anyway, the size of the .exe will be bigger than with linking with dll. An idea would be to build wxWidgets non-monolithic, but its seems that there are some issues (it was discussed somewhere in the forum, if I remember correctly).

Michael
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: barbarello on February 13, 2006, 01:44:47 pm
Yes it's exactly what i try to do....with parameters SHARE=0....
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: Michael on February 13, 2006, 01:55:26 pm
Did you try by using the same parameters as described in one of the topics cited above, but just changing SHARE to 0?

Michael
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: TDragon on February 13, 2006, 07:38:56 pm
So the folder created is gcc_msw
So change every occurence of "gcc_dll" in the build options (linker directories, compiler directories) to "gcc_msw". Or if the directory containing the library files is "gcc_lib", change to that.

Also remove WXUSINGDLL from the #defines.

Compile. Enjoy.
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: barbarello on February 13, 2006, 08:07:03 pm
Thanks a lot
I'm going to try this!
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: barbarello on February 13, 2006, 08:31:23 pm
Errors and more errors.

Here is my file. I added everything i've found....I know it's ridiculous, but....
Quote
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
   <FileVersion major="1" minor="3" />
   <Project>
      <Option title="STATIC" />
      <Option pch_mode="0" />
      <Option compiler="gcc" />
      <Build>
         <Target title="default">
            <Option output="wxwidgets_static_u.exe" />
            <Option type="0" />
            <Option compiler="gcc" />
            <Option includeInTargetAll="1" />
            <Option projectResourceIncludeDirsRelation="0" />
         </Target>
         <Environment>
            <Variable name="WX_CFG" value="" />
         </Environment>
      </Build>
      <Compiler>
         <Add option="-pipe" />
         <Add option="-mthreads" />
         <Add option="-Winvalid-pch" />
         <Add option="-D__GNUWIN32__" />
         <Add option="-D__WXMSW__" />
         <Add option="-DwxUSE_UNICODE" />
         <Add directory="I:\wxWidgets-2.6.2\include" />
         <Add directory="I:\wxWidgets-2.6.2\include\wx" />
         <Add directory="I:\wxWidgets-2.6.2\contrib\include" />
         <Add directory="I:\wxWidgets-2.6.2\include\wx\msw" />
         <Add directory="I:\wxWidgets-2.6.2\build\msw\gcc_msw" />
      </Compiler>
      <ResourceCompiler>
         <Add directory="I:\wxWidgets-2.6.2\include" />
         <Add directory="I:\wxWidgets-2.6.2\include\wx" />
         <Add directory="I:\wxWidgets-2.6.2\include\wx\msw" />
         <Add directory="I:\wxWidgets-2.6.2\build\msw\gcc_msw" />
      </ResourceCompiler>
      <Linker>
         <Add library="wxmswu" />
         <Add library="winspool" />
         <Add library="winmm" />
         <Add library="shell32" />
         <Add library="comctl32" />
         <Add library="ctl3d32" />
         <Add library="odbc32" />
         <Add library="advapi32" />
         <Add library="wsock32" />
         <Add library="opengl32" />
         <Add library="glu32" />
         <Add library="ole32" />
         <Add library="oleaut32" />
         <Add library="uuid" />
         <Add directory="I:\wxWidgets-2.6.2\lib" />
         <Add directory="I:\wxWidgets-2.6.2\include\wx" />
         <Add directory="I:\wxWidgets-2.6.2\include\wx\msw" />
         <Add directory="I:\wxWidgets-2.6.2\build\msw\gcc_msw" />
      </Linker>
      <Unit filename="main.cpp">
         <Option compilerVar="CPP" />
         <Option target="default" />
      </Unit>
   </Project>
</CodeBlocks_project_file>
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: Michael on February 13, 2006, 08:51:46 pm
Quote
...
<Target title="default">
  <Option output="wxwidgets_static_u.exe" />
...

May be I am wrong but do you have set the output as .exe? It should be .a (static library) :?. You cannot have wxWidgets as .exe.

Michael
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: barbarello on February 13, 2006, 08:58:26 pm
OK you are really nice guys !

I thanks you all

But it's boring me, and i will continue to works with DLL separatly.
I really understand anything of IDE compilating parameters (surely because it's not interest me  :lol: ).

Thanks for your replies :D
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: TDragon on February 13, 2006, 09:24:44 pm
May be I am wrong but do you have set the output as .exe? It should be .a (static library) :?. You cannot have wxWidgets as .exe.
According to his first post, he's already successfully compiled wxWidgets, and is now trying to compile a program using wxWidgets.

barbarello, there are several things wrong I see in your project's options:
Cheers,
JohnE
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: tiwag on February 13, 2006, 10:03:25 pm
@barbarello

give the attached project a try, it should build quite nice (at least it does for me)
if your wx-widgets directory is "I:\wxWidgets-2.6.2"

build the wxRelease target only, if you don't have a debug-version of wxWidgets.

good luck, tiwag

[attachment deleted by admin]
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: barbarello on February 13, 2006, 10:39:14 pm
You spend many time to help me  :oops:

@TIWAG

Here is the error (and many comes after depending of this file, i thing)
Quote
wx/setup.h: No such file or directory

@TDragon

Many errors and so more....

Quote
I:\wx\lib\gcc_lib/libwxmsw26.a(monolib_app.o):app.cpp:(.text+0x6d5): undefined reference to `InitCommonControls@0'
I:\wx\lib\gcc_lib/libwxmsw26.a(monolib_app.o):app.cpp:(.text+0x6e1): undefined reference to `OleInitialize@4'
I:\wx\lib\gcc_lib/libwxmsw26.a(monolib_app.o):app.cpp:(.text+0x90e): undefined reference to `OleUninitialize@0'
I:\wx\lib\gcc_lib/libwxmsw26.a(monolib_window.o):window.cpp:(.text+0xa2d2): undefined reference to `_TrackMouseEvent@4'
I:\wx\lib\gcc_lib/libwxmsw26.a(monolib_filename.o):filename.cpp:(.text+0x1805): undefined reference to `CoCreateInstance@20'
I:\wx\lib\gcc_lib/libwxmsw26.a(monolib_filename.o):filename.cpp:(.text+0x1827): undefined reference to `IID_IPersistFile'
I:\wx\lib\gcc_lib/libwxmsw26.a(monolib_statbr95.o):statbr95.cpp:(.text+0x16c): undefined reference to `CreateStatusWindowA@16'
I:\wx\lib\gcc_lib/libwxmsw26.a(monolib_droptgt.o):droptgt.cpp:(.text+0x8e4): undefined reference to `CoLockObjectExternal@12'
I:\wx\lib\gcc_lib/libwxmsw26.a(monolib_droptgt.o):droptgt.cpp:(.text+0x8fc): undefined reference to `RegisterDragDrop@8'
I:\wx\lib\gcc_lib/libwxmsw26.a(monolib_droptgt.o):droptgt.cpp:(.text+0x92e): undefined reference to `CoLockObjectExternal@12'

I compile wxWidget like this :

Quote
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=0 MONOLITHIC=1 BUILD=release UNICODE=0

And now my parameters look like that

Quote
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
   <FileVersion major="1" minor="3" />
   <Project>
      <Option title="static" />
      <Option pch_mode="0" />
      <Option compiler="gcc" />
      <Build>
         <Target title="default">
            <Option output="wxwidgets_static.exe" />
            <Option type="0" />
            <Option compiler="gcc" />
            <Option includeInTargetAll="1" />
            <Option projectResourceIncludeDirsRelation="0" />
         </Target>
         <Environment>
            <Variable name="WX_CFG" value="u" />
            <Variable name="WX" value="I:\wx" />
         </Environment>
      </Build>
      <Compiler>
         <Add option="-pipe" />
         <Add option="-mthreads" />
         <Add option="-Winvalid-pch" />
         <Add option='-include &quot;wx_pch.h&quot;' />
         <Add option="-D__GNUWIN32__" />
         <Add option="-D__WXMSW__" />
         <Add option="-DUSE_PCH" />
         <Add directory="I:\wx\include" />
         <Add directory="I:\wx\contrib\include" />
         <Add directory="I:\wx\lib\gcc_lib\msw" />
         <Add directory="I:\wx\lib\gcc_lib\msw\wx" />
      </Compiler>
      <ResourceCompiler>
         <Add directory="I:\wx\include" />
      </ResourceCompiler>
      <Linker>
         <Add library="wxmsw26" />
         <Add directory="I:\wx\lib\gcc_lib" />
      </Linker>
      <Unit filename="main.cpp">
         <Option compilerVar="CPP" />
         <Option target="default" />
      </Unit>
      <Unit filename="wx_pch.h">
         <Option compilerVar="CPP" />
         <Option link="0" />
         <Option weight="0" />
         <Option target="default" />
      </Unit>
   </Project>
</CodeBlocks_project_file>



Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: barbarello on February 13, 2006, 10:52:05 pm
I've made a copy of setup.h in include/wx and now get error :
Quote
cannot find -lwxmsw26d
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: TDragon on February 13, 2006, 10:58:17 pm
I've made a copy of setup.h in include/wx...
Not a good idea. Don't mess around with the structure of big libraries unless you know what you're doing. As long as you have <wxwidgets>/lib/gcc_lib/msw in your include paths, it should be able to find setup.h without trouble. "Cannot find -lwxmsw26d" means that you have that library somewhere in your list of libraries to link, where you shouldn't. (Unless you compiled the debug version of wxWidgets -- which you didn't.)

Lastly -- I was wrong in saying that the wx libs were all you needed; the ones that were in your list previously were also necessary. My apologies.
Title: Re: Compiling wxWidgets SHARED=0 used with CODEBLOCKS
Post by: barbarello on February 13, 2006, 11:29:44 pm
OK ! TIWAG it works now.

I used wxRelase target in Project properties and not in BUILD target....

It's OK, I have to read slowly this file and try to understand.

Big Big thanks to you guys !!

 :mrgreen: