Error while compiling wxWidget with MingW CodeBlock Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Cloud_Strife_Han
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Jan 20, 2018 6:03 am

Error while compiling wxWidget with MingW CodeBlock

Post by Cloud_Strife_Han »

Hi you guys,
I have a problem with compiling wxWidgets.

I exectute this command:

Code: Select all

mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-fno-keep-inline-dllexport" 
gcc -c -o gcc_mswudll\wxregex_regcomp.o -O2 -mthreads -DHAVE_W32API_H -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -D__WXMSW__ -D_UNICODE -MTgcc_mswudll\wxregex_regcomp.o -MFgcc_mswudll\wxregex_regcomp.o.d -MD -MP ../../src/regex/regcomp.c
makefile.gcc:5778: recipe for target 'gcc_mswudll\wxregex_regcomp.o' failed
I have found and tried some resolves on google but it's not working. I have also added mingw\bin, and ming\libexe\..<version> into PATH.

This is my PATH:
PATH=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft SDKs\F#\3.0\Framework\v4.0\;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\VCPackages;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools;C:\Program Files (x86)\Windows Kits\8.0\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\; C:\Windows\bin;C:\wxWidgets-3.1.0\build\msw;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\PowerShell\6.0.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;"C:\Program Files (x86)\CodeBlocks\MinGW\bin";"C:\Program Files (x86)\CodeBlocks\MinGW\libexec\gcc\mingw32"\;"C:\Program Files (x86)\CodeBlocks\MinGW\libexec\gcc\mingw32\5.1.0"
Some informations about my machine:
[+] Windows 7 64bit.
[+] Compile wxWidget with mingw 5.x.x
[+] I use Dev Command Prompt for VS

Please give me some resolutions, thanks!
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: Error while compiling wxWidget with MingW CodeBlock

Post by eranon »

Hello, Don't know about your error, but I see some inconsistencies in what you written:

You shouldn't add quotes for the paths in your PATH. Even when there're space inside it, you just add it as is.
You have an extra "\" after ending quote in: "C:\Program Files (x86)\CodeBlocks\MinGW\libexec\gcc\mingw32"\;

I don't understand why you use the VS prompt for a MinGW building.

Also, I would place the <mingw>\bin path at the beginning of the PATH (if you don't want to keep it there permanently, you can set it locally at prompt before to run your command line for building.

And I'll install TDM-GCC myself rather than relaying on the one shipped with Codeblocks.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Re: Error while compiling wxWidget with MingW CodeBlock

Post by stahta01 »

What wxWidgets version are you trying to compile?

Why are you trying to do an monolithic wxWidgets build?

Why are you doing "VENDOR=cb"?

Tim S.
Cloud_Strife_Han
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Jan 20, 2018 6:03 am

Re: Error while compiling wxWidget with MingW CodeBlock

Post by Cloud_Strife_Han »

eranon wrote:Hello, Don't know about your error, but I see some inconsistencies in what you written:

You shouldn't add quotes for the paths in your PATH. Even when there're space inside it, you just add it as is.
You have an extra "\" after ending quote in: "C:\Program Files (x86)\CodeBlocks\MinGW\libexec\gcc\mingw32"\;

I don't understand why you use the VS prompt for a MinGW building.

Also, I would place the <mingw>\bin path at the beginning of the PATH (if you don't want to keep it there permanently, you can set it locally at prompt before to run your command line for building.

And I'll install TDM-GCC myself rather than relaying on the one shipped with Codeblocks.
Thank for your responding! I'll try your way.

Have problem if using VS prompt? I just use as a habit.
Cloud_Strife_Han
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Jan 20, 2018 6:03 am

Re: Error while compiling wxWidget with MingW CodeBlock

Post by Cloud_Strife_Han »

I tried to install TDM-GCC alone and using cmd to compile. But I got the same result!

This is my PATH:

PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\; C:\Windows\bin;C:\wxWidgets-3.1.0\build\msw;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\PowerShell\6.0.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\TDM-GCC-64\bin


My command:

Code: Select all

mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release
and I got this result:
gcc -c -o gcc_mswudll\wxregex_regcomp.o -O2 -mthreads -DHAVE_W32API_H -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -D__WXMSW__ -D_UNICODE -MTgcc_mswudll\wxregex_regcomp.o -MFgcc_mswudll\wxregex_regcomp.o.d -MD -MP ../../src/regex/regcomp.c
makefile.gcc:5778: recipe for target 'gcc_mswudll\wxregex_regcomp.o' failed
Manolo
Can't get richer than this
Can't get richer than this
Posts: 827
Joined: Mon Apr 30, 2012 11:07 pm

Re: Error while compiling wxWidget with MingW CodeBlock

Post by Manolo »

It seems yo have leftovers from previous installations and tries.
Use:

Code: Select all

mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release clean
and then

Code: Select all

mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release
If it still doesn't work my advice is to start from scratch:
1. Delete everything related to wx
2. Delete everything related to mingw (TDM included)
3. Download wx and TDM and unpack/install them.
4. Be sure of your PATH includes C:\TDM-GCC-64\bin (for the 64 bit version)
5. Use the command lines I showed.
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: Error while compiling wxWidget with MingW CodeBlock

Post by eranon »

Cloud_Strife_Han wrote:Have problem if using VS prompt? I just use as a habit.
The dedicated VS prompt is overloaded with VS-specific environment variables (see vcvarsall.bat and others batch scripts in the VS's tree on disk). In the best case, it's useless and in the worse one may conflict with your current operations...

I would do what Manolo said above... And, again, I would place <tdm-gcc>\bin at the beginning of the PATH.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Cloud_Strife_Han
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Jan 20, 2018 6:03 am

Re: Error while compiling wxWidget with MingW CodeBlock

Post by Cloud_Strife_Han »

Manolo wrote:It seems yo have leftovers from previous installations and tries.
Use:

Code: Select all

mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release clean
and then

Code: Select all

mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release
If it still doesn't work my advice is to start from scratch:
1. Delete everything related to wx
2. Delete everything related to mingw (TDM included)
3. Download wx and TDM and unpack/install them.
4. Be sure of your PATH includes C:\TDM-GCC-64\bin (for the 64 bit version)
5. Use the command lines I showed.
It works, thanks. However, I got the error below when I try to create a new project!
Image

Do you have any suggestion?
Cloud_Strife_Han
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Jan 20, 2018 6:03 am

Re: Error while compiling wxWidget with MingW CodeBlock

Post by Cloud_Strife_Han »

eranon wrote:
Cloud_Strife_Han wrote:Have problem if using VS prompt? I just use as a habit.
The dedicated VS prompt is overloaded with VS-specific environment variables (see vcvarsall.bat and others batch scripts in the VS's tree on disk). In the best case, it's useless and in the worse one may conflict with your current operations...

I would do what Manolo said above... And, again, I would place <tdm-gcc>\bin at the beginning of the PATH.
I did it, thanks!
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Re: Error while compiling wxWidget with MingW CodeBlock

Post by stahta01 »

Cloud_Strife_Han wrote: It works, thanks. However, I got the error below when I try to create a new project!

Do you have any suggestion?
Inside code::Blocks select the options that match the ones you used to build wxWidgets.

SHARED=1 means check "Use wxWidgets DLL"
UNICODE=1 means check "Enable Unicode"

Tim S.
Cloud_Strife_Han
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Jan 20, 2018 6:03 am

Re: Error while compiling wxWidget with MingW CodeBlock

Post by Cloud_Strife_Han »

stahta01 wrote:
Cloud_Strife_Han wrote: It works, thanks. However, I got the error below when I try to create a new project!

Do you have any suggestion?
Inside code::Blocks select the options that match the ones you used to build wxWidgets.

SHARED=1 means check "Use wxWidgets DLL"
UNICODE=1 means check "Enable Unicode"

Tim S.
Sorry, I am new at wxWidgets and CB. Could you explain clearly? Which options I need to match? I have checked 2 options that you said, but I dont work! I got the same warning...
Last edited by Cloud_Strife_Han on Sun Jan 21, 2018 8:47 am, edited 1 time in total.
Cloud_Strife_Han
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Jan 20, 2018 6:03 am

Re: Error while compiling wxWidget with MingW CodeBlock

Post by Cloud_Strife_Han »

I ignored the unmatching configuration then I got this error in CB when build my project:

||=== Build: Debug in ForHelperGUI (compiler: GNU GCC Compiler) ===|
C:\wxWidgets-3.1.0\include\wx\platform.h|136|fatal error: /wx/setup.h: No such file or directory|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|


I sure, I added lib, variable for CB.
Image

Compiler: C:\wxWidgets-3.1.0\lib\gcc_dll\mswu
LInker: C:\wxWidgets-3.1.0\lib\gcc_dll
Resource Compiler: C:\wxWidgets-3.1.0\lib\gcc_dll\mswu
Last edited by Cloud_Strife_Han on Sun Jan 21, 2018 2:15 pm, edited 1 time in total.
Cloud_Strife_Han
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Jan 20, 2018 6:03 am

Re: Error while compiling wxWidget with MingW CodeBlock

Post by Cloud_Strife_Han »

I also got this error while compling...

C:\wxWidgets-3.1.0\include\wx\debug.h|18|fatal error: wx/cpp.h: No such file or directory|

#include "C:/wxWidgets-3.1.0/include/wx/chartype.h" // for __TFILE__ and wxChar
#include "wx/cpp.h" // for __WXFUNCTION__
#include "wx/dlimpexp.h" // for WXDLLIMPEXP_FWD_BASE

if I add path C:/wxWidgets-3.1.0/include/ before \wx it works! But there are too many \wx need to add!
I set Variable for wx.
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: Error while compiling wxWidget with MingW CodeBlock

Post by eranon »

Hello,

What stahta01 told you is that your project have to use the same build options than the one you used to compile wxWidgets. So, you have to select the same compiler options, complete the appropriated definitions, indicate the right libraries to link to (in the right order) and point the right search directories relaying (for the Codeblocks case) on the global Codeblocks variables.

Here, you show us you added the Codeblocks variable to point the wxWidgets directory, but how do you use this variable in your project's search directories tab for compiler and linker? Can you show the content of your tab about search directories in Codeblocks?

Well, Codeblocks is very versatile (you can do close to what you want without the impression to use a black box like in some others major integrated development environments -- I say this with Visual Studio and Xcode in mind), but it's not a click and forget IDE; you're responsible of every detail. So, if your questions become more Codeblocks specific, it could be a good idea to directly ask on the Codeblocks forum (sure, you'll get more answers, and faster).
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Cloud_Strife_Han
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Jan 20, 2018 6:03 am

Re: Error while compiling wxWidget with MingW CodeBlock

Post by Cloud_Strife_Han »

Thank for your reply! I solved the problem :D
eranon wrote:Hello,

What stahta01 told you is that your project have to use the same build options than the one you used to compile wxWidgets. So, you have to select the same compiler options, complete the appropriated definitions, indicate the right libraries to link to (in the right order) and point the right search directories relaying (for the Codeblocks case) on the global Codeblocks variables.

Here, you show us you added the Codeblocks variable to point the wxWidgets directory, but how do you use this variable in your project's search directories tab for compiler and linker? Can you show the content of your tab about search directories in Codeblocks?

Well, Codeblocks is very versatile (you can do close to what you want without the impression to use a black box like in some others major integrated development environments -- I say this with Visual Studio and Xcode in mind), but it's not a click and forget IDE; you're responsible of every detail. So, if your questions become more Codeblocks specific, it could be a good idea to directly ask on the Codeblocks forum (sure, you'll get more answers, and faster).
Post Reply