Which g++ compiler to use with CodeLite and wxWidgets?

CodeLite installation/troubleshooting forum
User avatar
ColleenKobe
CodeLite Expert
Posts: 130
Joined: Wed Mar 30, 2016 4:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Which g++ compiler to use with CodeLite and wxWidgets?

Post by ColleenKobe »

Hi. I'm a new CodeLite user. I would like to use CodeLite as my IDE to build Windows programs with wxWidgets.

My question is about what compiler to use. Is there a g++ compiler that is highly recommended to use with CodeLite and wxWidgets?

Here are some choices.
Here are my answers to the question list in http://forums.codelite.org/viewtopic.php?f=11&t=804:
  • 1. I am using CodeLite 9.1.0, 32-bit.
    2. I don't know if CodeLite is self-compiled. I didn't compile it. Does that answer the question?
    3. My OS is Windows 7, and my target platform is Windows.
    4. My compiler version is what my question is about.
Thanks in advance for your comments.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Which g++ compiler to use with CodeLite and wxWidgets?

Post by eranif »

ColleenKobe wrote:tdm-gcc: http://tdm-gcc.tdragon.net/
I use this one. If you can - use the 64 bit version

Eran
Make sure you have read the HOW TO POST thread
User avatar
ColleenKobe
CodeLite Expert
Posts: 130
Joined: Wed Mar 30, 2016 4:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Which g++ compiler to use with CodeLite and wxWidgets?

Post by ColleenKobe »

Thank you, Eran!

I downloaded tdm-gcc. Everything seems in order.

Now I want to compile wxWidgets v3.1.0.

I am following the directions on http://codelite.org/Developers/BuildingWxWidgetsWin. I'm having problems because the instructions on that web page don't match what directories are actually built after running the mingw32-make.

Specifically, under "Release", the instructions say to:

Code: Select all

     open CMD.EXE, cd to \Path\To\wxWidgets\Sources\build\msw and type:
I assume "\Path\To\wxWidgets\Sources" is equivalent to %WXWIN%\build\msw, where %WXWIN% is the directory into which wxWidgets was installed. In my case, that's C:\wxWidgets.

Code: Select all

  mingw32-make -f makefile.gcc setup_h

    Next, open the file: \path\to\wxwidgets\lib\gcc_dll\mswu\wx\setup.h and ensure that wxUSE_GRAPHICS_CONTEXT is set to 1:
The above statement is the real problem. There IS NO \lib\gcc_dll\mswu\wx\ directory. Instead, there IS a \lib\gcc_lib\mswud\wx directory.

What's the difference between a gcc_dll and a gcc_lib directory?

The bottom line question is: What was the execution of the make file supposed to create? This is supposed to be for a Windows 7, Release build. Here are the options.
  • a. \lib\gcc_lib\mswud\wx\ is correct, and \lib\gcc_dll\mswu\wx\ is wrong. Action: I need to change the make file to create \lib\gcc_lib\mswud\wx\.

    b. \lib\gcc_dll\mswu\wx\ is correct, and \lib\gcc_lib\mswud\wx\ is wrong. Action: I should fix the text in the instructions to show \lib\gcc_lib\mswud\wx, and leave the make file as-is.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Which g++ compiler to use with CodeLite and wxWidgets?

Post by eranif »

ColleenKobe wrote: There IS NO \lib\gcc_dll\mswu\wx\ directory. Instead, there IS a \lib\gcc_lib\mswud\wx directory.

What's the difference between a gcc_dll and a gcc_lib directory?
IIRC, the 'lib' is created when building wxWidgets as an archive ("static"), while the "dll" version is when building wxWidgets in "shared" mode.
I guess that the mix is because when I ran this command, I already have the config file created and the makefile *knows* that I am building wxWidgets in "shared" mode.

Can you try this one:

Code: Select all

mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 MONOLITHIC=1 BUILD=release setup_h
Does this fixes the problem for you?

This step is for creating setup.h, its how wxWidgets works: they have a "template" file called setup0.h which is copied and renamed to "setup.h" - this step creates this file and places it in its proper location

Eran
Make sure you have read the HOW TO POST thread
User avatar
ColleenKobe
CodeLite Expert
Posts: 130
Joined: Wed Mar 30, 2016 4:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Which g++ compiler to use with CodeLite and wxWidgets?

Post by ColleenKobe »

Hi, Eran,

Thank you so much for answering so quickly!

Thank you for the explanation about "lib" vs. "dll," but I'm still not quite clear. When you say "Shared" mode, does that mean that multiple people might be editing that file at once? And "static" means that nobody ever edits that file?

Regarding your suggestion: here is how I implemented it: I deleted my entire wxWidgets folder, reinstalled wxWidgets 3.1.0, and opened a DOS shell. I checked in Windows Explorer, and I had zero directories under \lib when I started. I returned to the DOS shell and first typed the first line in the web page commands. Then I ran the command you gave me. Here is the output.

Code: Select all

C:\wxWidgets\build\msw>mingw32-make -f makefile.gcc setup_h
if not exist ..\..\lib\gcc_lib mkdir ..\..\lib\gcc_lib
if not exist ..\..\lib\gcc_lib\mswud mkdir ..\..\lib\gcc_lib\mswud
if not exist ..\..\lib\gcc_lib\mswud\wx mkdir ..\..\lib\gcc_lib\mswud\wx
if not exist ..\..\lib\gcc_lib\mswud\wx\setup.h copy ..\..\include\wx\msw\setup.h ..\..\lib\gcc_lib\mswud\wx\setup.h
        1 file(s) copied.
if not exist ..\..\lib\gcc_lib\mswud\wx\msw mkdir ..\..\lib\gcc_lib\mswud\wx\msw
gcc -E "..\..\include\wx\msw\genrcdefs.h" > "..\..\lib\gcc_lib\mswud\wx\msw\rcdefs.h"

C:\wxWidgets\build\msw>timethis "mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 MONOLITHIC=1 BUILD=release setup_h"

TimeThis :  Command Line :  mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 MONOLITHIC=1 BUILD=release setup_h
TimeThis :    Start Time :  Thu Mar 31 11:08:58 2016

if not exist ..\..\lib\gcc_dll mkdir ..\..\lib\gcc_dll
if not exist ..\..\lib\gcc_dll\mswu mkdir ..\..\lib\gcc_dll\mswu
if not exist ..\..\lib\gcc_dll\mswu\wx mkdir ..\..\lib\gcc_dll\mswu\wx
if not exist ..\..\lib\gcc_dll\mswu\wx\setup.h copy ..\..\include\wx\msw\setup.h ..\..\lib\gcc_dll\mswu\wx\setup.h
        1 file(s) copied.
if not exist ..\..\lib\gcc_dll\mswu\wx\msw mkdir ..\..\lib\gcc_dll\mswu\wx\msw
gcc -E "..\..\include\wx\msw\genrcdefs.h" > "..\..\lib\gcc_dll\mswu\wx\msw\rcdefs.h"

TimeThis :  Command Line :  mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 MONOLITHIC=1 BUILD=release setup_h
TimeThis :    Start Time :  Thu Mar 31 11:08:58 2016
TimeThis :      End Time :  Thu Mar 31 11:08:59 2016
TimeThis :  Elapsed Time :  00:00:00.224

C:\wxWidgets\build\msw>
And now, if you look at the screen shot below, you can see that I now have both the lib\gcc_lib and lib\gcc_dll directories! Yay! I hope that my builds will complete successfully now.

I will add the command you gave me, to my batch file that is supposed to build wxWidgets.

One last question for now: what does "mswud" stand for, and "mswu"?

Thank you again!
You do not have the required permissions to view the files attached to this post.
User avatar
ColleenKobe
CodeLite Expert
Posts: 130
Joined: Wed Mar 30, 2016 4:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Which g++ compiler to use with CodeLite and wxWidgets?

Post by ColleenKobe »

Sadly, my build crashed. See the attachment of my printscreen.

What does "ld returned 5 exit status" mean? I googled it, but the links I got were not helpful. This page https://wiki.wxwidgets.org/Compiling_wx ... with_MinGW tells me to start over again--which is what I've BEEN doing.

Suggestions?

How can I tell if the build succeeded?
You do not have the required permissions to view the files attached to this post.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Which g++ compiler to use with CodeLite and wxWidgets?

Post by eranif »

Are you sure you are using the correct mingw32-make.exe?
Can you print the $PATH% environment variable? (echo %path%)
Try building the "Release" configuration (you dont really need debug version of wxWidgets, unless you plan on debugging it)

Eran
Make sure you have read the HOW TO POST thread
User avatar
ColleenKobe
CodeLite Expert
Posts: 130
Joined: Wed Mar 30, 2016 4:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Which g++ compiler to use with CodeLite and wxWidgets?

Post by ColleenKobe »

eranif wrote:Are you sure you are using the correct mingw32-make.exe?
Heh. I'm not at all sure. Since I'm trying to compile wxWidgets, using the 64-bit version seemed like the right one to use. But maybe not?

Here is the first occurrence of mingw32-make.exe that occurs in my path, and the directory in which it's located:

Code: Select all

C:\wxWidgets\build\msw>where mingw32-make.exe
C:\TDM-GCC-64\bin\mingw32-make.exe

C:\wxWidgets\build\msw>
I have two versions of mingw32-make.exe. One is in C:\TDM-GCC-32\bin, and the other is in C:\TDM-GCC-64\bin.
Can you print the $PATH% environment variable? (echo %path%)
Certainly! Also, here are my system environment variables WXWIN and WXCFG.

Code: Select all

C:\wxWidgets\build\msw>path
PATH=C:\Windows\;C:\Windows\System32\;C:\Windows\System32\Wbem\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\s
ystem32\config\systemprofile\.dnx\bin\;C:\ProgramData\Oracle\Java\javapath\;C:\Program Files (x86)\Intel\iCLS Client\;C:
\Program Files\Intel\iCLS Client\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C
:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static\;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86\;C:\Prog
ram Files (x86)\Intel\OpenCL SDK\3.0\bin\x64\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL\;C:\Progr
am Files\Intel\Intel(R) Management Engine Components\IPT\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Compon
ents\DAL\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT\;C:\Program Files\Microsoft DNX\Dnvm\;C
:\Program Files (x86)\KEDITW\;C:\Program Files (x86)\KEDITW\User\;C:\Program Files (x86)\KEDITW-DOS\;C:\TDM-GCC-64\bin\;
C:\wxWidgets\;C:\wxWidgets\bin\;C:\wxWidgets\include\;C:\wxWidgets\lib\gcc_dll\;F:\;F:\util\;

C:\wxWidgets\build\msw>set wxwin
WXWIN=C:\wxWidgets

C:\wxWidgets\build\msw>set wxcfg
WXCFG=gcc_lib/mswud

C:\wxWidgets\build\msw>
What is WXCFG supposed to be for a Windows / release, build? I'm not sure if wxWidgets is supposed to be in the form of a DLL or in an EXE...though I guess an EXE doesn't make much sense if I'm going to be using wxWidgets GUI routines to build my pages. So a DLL, then.
Try building the "Release" configuration (you dont really need debug version of wxWidgets, unless you plan on debugging it)
Okay! I deleted all the directories and files under C:\wxWidgets, and then reinstalled wxWidgets 3.1.0.

Here are the commands I use to build the release version of wxWidgets:

Code: Select all

C:
cd %WXWIN%\build\msw

mingw32-make -f makefile.gcc setup_h
mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 MONOLITHIC=1 BUILD=release setup_h

mingw32-make -f Makefile.gcc SHARED=1 UNICODE=1 BUILD=release VENDOR=cl CXXFLAGS="-fno-keep-inline-dllexport -std=c++11" MONOLITHIC=1 clean
mingw32-make -f Makefile.gcc SHARED=1 UNICODE=1 BUILD=release VENDOR=cl CXXFLAGS="-fno-keep-inline-dllexport -std=c++11" MONOLITHIC=1
I just ran those commands. Here is how the build ended (after half an hour or so):

Code: Select all

In file included from ..\..\include/wx/msw/private.h:21:0,
                 from ../../src/msw/glcanvas.cpp:33:
..\..\include/wx/window.h:1917:13: note: declared here
 inline void wxWindowBase::SetInitialBestSize(const wxSize& size)
             ^
../../src/msw/glcanvas.cpp:1371:1: warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated
: use SetInitialSize() instead. [-Wdeprecated-declarations]
 }
 ^
In file included from ..\..\include/wx/msw/private.h:21:0,
                 from ../../src/msw/glcanvas.cpp:33:
..\..\include/wx/window.h:1917:13: note: declared here
 inline void wxWindowBase::SetInitialBestSize(const wxSize& size)
             ^
g++ -shared -fPIC -o ..\..\lib\gcc_dll\wxmsw310u_gl_gcc_cl.dll gcc_mswudll\gldll_dummy.o gcc_mswudll\gldll_version_rc.o
gcc_mswudll\gldll_glcmn.o gcc_mswudll\gldll_glcanvas.o   -mthreads -L..\..\lib\gcc_dll -Wl,--out-implib=..\..\lib\gcc_dl
l\libwxmsw31u_gl.a    -lwxtiff -lwxjpeg -lwxpng   -lwxzlib -lwxregexu -lwxexpat   -lkernel32 -luser32 -lgdi32 -lcomdlg32
 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lw
ininet   -lwxmsw31u -lopengl32 -lglu32

C:\wxWidgets\build\msw>
So, was the build successful? How can I tell?

Thanks for your help!
User avatar
ColleenKobe
CodeLite Expert
Posts: 130
Joined: Wed Mar 30, 2016 4:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Which g++ compiler to use with CodeLite and wxWidgets?

Post by ColleenKobe »

Happy news!

I decided to just assume the release build was successful. I followed the directions in http://codelite.org/LiteEditor/WxCrafterHelloWorld to build a "Hello World" program. I had a little trouble figuring out the correct format for the CodeLite environment variables, but in the end, the program ran!!!! I displayed an image and clicked my button and the correct new form was displayed!
Hello World!.jpg
WOOO HOOOO!

Today I plan to explore CodeLite and get more familiar with it.

Thank you for your help, Eran! I really appreciate it.

Colleen
in still-snowy Hancock, Michigan, USA
You do not have the required permissions to view the files attached to this post.
Post Reply