Page 1 of 1

wx-config not executing.

Posted: Wed Jul 27, 2011 4:19 pm
by drummerp
Can Code::Blocks with MinGW (which includes MSYS, so it wouldn't make sense not to) not utilise libraries installed via "make & make install" through MSYS? I did this with wxWidgets 2.9.1 (I think), and tested that in the MSYS command line, wx-config does print something, and I even checked that wx-config --cxxflags and wx-config --libs returned the right things.

However, I added `wx-config --cxxflags` to the Compiler Options tab and the `wx-config --libs` command to the Linker Options tab, and yet nonetheless, when I try to compile, it says that it can't find the include files.

The output of wx-config --cxxflags is "-I/usr/local/lib/wx/include/msw-unicode-static-2.9 -I/usr/local/include/wx-2.9 -D_LARGEFILE_SOURCE=unknown -D__WXMSW__ -mthreads -fno_exceptions"

The output of wx-config --libs is "-L/usr/local/lib -W1,--subsystem,windows -mwindows /usr/local/lib/libwx_mswu-2.9.a -lwxregexu-2.9 -lwxexpat-2.9 -lwxtiff-2.9 -lwxjpeg-2.9 -lwxpng-2.9 -lwxzlib-2.9 -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32"

Please, any help would be appreciated. I would love to know why it is that my code is not compiling. I have not had much luck compiling wxWidgets applications (the library itself compiles fine) on Windows in the past, due to having to add large amounts of Win32 libraries into my linker. I thought of this nifty program from Linux and wondered whether this couldn't make things easier. I can see that it would, if it were actually used properly. All I want right now is to get my code working.

Re: wx-config not executing.

Posted: Wed Jul 27, 2011 4:32 pm
by ouch67
what's the build log look like? Also are you sure the libraries are in fact in the folders it gives?

also be sure your have your tool chain set up so that msys is actually being used. (codeblocks doesn't do that by default if I recall, it just sees mingw and uses it directly)

Re: wx-config not executing.

Posted: Wed Jul 27, 2011 4:39 pm
by drummerp
Direct from the (MSYS) command line:

$ ls /usr/local/include
wx-2.8 wx-2.9

$ ls /usr/local/include/wx-2.9
wx

$ ls /usr/local/include/wx-2.9/wx
[long list of header files]

$ ls/usr/local/lib
[list of .a files with wxWidgets library names, and a "wx" folder]

Build log:

Code: Select all

C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:49:23: error: wx/wxprec.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:57:19: error: wx/wx.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:60:65: error: wx/glcanvas.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:61:25: error: wx/imaglist.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:62:25: error: wx/treectrl.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:63:25: error: wx/listctrl.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:64:25: error: wx/aboutdlg.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:65:25: error: wx/wfstream.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:66:34: error: wx/propgrid/propgrid.h: No such file or directory
-snip-
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:169: error: 'wxTreeItemId' does not name a type
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:686: error: 'wxTreeCtrl' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:687: error: expected initializer before '*' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:692: error: expected initializer before '*' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:694: error: variable or field 'Print' declared void
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:694: error: 'wxString' was not declared in this scope
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:696: error: variable or field 'Warn' declared void
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:696: error: 'wxString' was not declared in this scope
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:698: error: variable or field 'Error' declared void
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:698: error: 'wxString' was not declared in this scope
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:717: error: expected class-name before '{' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:719: error: ISO C++ forbids declaration of 'wxString' with no type
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:719: error: expected ',' or '...' before '&' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:725: error: ISO C++ forbids declaration of 'DECLARE_EVENT_TABLE' with no type
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:727: error: expected ';' before 'void'
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:728: error: 'wxMouseEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:731: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:732: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:733: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:734: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:735: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:736: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:737: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:738: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:739: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:740: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:741: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:742: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:743: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:744: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:745: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:746: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:747: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:748: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:749: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:750: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:751: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:752: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:753: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:754: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:755: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:756: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:757: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:758: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:759: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:760: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:761: error: 'wxCommandEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:765: error: expected class-name before ',' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:767: error: expected ')' before '*' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:775: error: ISO C++ forbids declaration of 'DECLARE_EVENT_TABLE' with no type
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:776: error: expected ';' before 'void'
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:777: error: 'wxIdleEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:778: error: 'wxPaintEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:779: error: 'wxEraseEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:780: error: 'wxSizeEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:781: error: 'wxMouseEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:782: error: 'wxKeyEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:783: error: 'wxKeyEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:791: error: expected class-name before '{' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:793: error: expected ')' before '*' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:798: error: ISO C++ forbids declaration of 'DECLARE_EVENT_TABLE' with no type
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:799: error: expected ';' before 'void'
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:800: error: 'wxSizeEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:801: error: 'wxPaintEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:803: error: expected class-name before '{' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:805: error: expected ')' before '*' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:809: error: ISO C++ forbids declaration of 'wxTreeCtrl' with no type
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:809: error: expected ';' before '*' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:811: error: ISO C++ forbids declaration of 'DECLARE_EVENT_TABLE' with no type
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:812: error: expected ';' before 'void'
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:813: error: 'wxMenuEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:814: error: 'wxTreeEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:815: error: 'wxTreeEvent' has not been declared
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:818: error: expected class-name before '{' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:820: error: expected ')' before '*' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:823: error: ISO C++ forbids declaration of 'wxPropertyGrid' with no type
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:823: error: expected ';' before '*' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:826: error: ISO C++ forbids declaration of 'DECLARE_EVENT_TABLE' with no type
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:827: error: expected ';' before 'void'
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:830: error: expected class-name before '{' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:832: error: expected ')' before '*' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:836: error: ISO C++ forbids declaration of 'DECLARE_EVENT_TABLE' with no type
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:837: error: expected ';' before '}' token
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:837: error: expected ';' before '}' token
-snip-
It would continue on for a really long time if I didn't cut it off. But, as you can see, it's failing to include the wxWidgets headers, and then complaining about my usage of classes, functions, and macros from the library.

Re: wx-config not executing.

Posted: Wed Jul 27, 2011 4:40 pm
by drummerp
ouch67 wrote:also be sure your have your tool chain set up so that msys is actually being used. (codeblocks doesn't do that by default if I recall, it just sees mingw and uses it directly)
Didn't see that until after my previous post... Hm. How would I go about doing that? I don't think I did, didn't know I needed to, which may be the cause of the problem.

Re: wx-config not executing.

Posted: Wed Jul 27, 2011 4:43 pm
by ouch67
oh, you haven't turned on full command line logging.

go to settings->compiler and debugger->other settings and change compiler logging to "full command line".

once you do that then post the log again. it will tell you what is being launched and how after you do that.

Re: wx-config not executing.

Posted: Thu Jul 28, 2011 1:57 am
by drummerp
With that, my build log says:

Code: Select all

mingw32-g++.exe -Wall  -fexpensive-optimizations -Os -O3 -O2 -O1 -O -Wredundant-decls -Winline -Wunreachable-code -Wmissing-include-dirs  -fexceptions -D__WXMSW__ -DwxUSE_UNICODE -D__WXDEBUG__  -Wredundant-decls -Wundef -Winline -Wmissing-include-dirs   -I..\SurrealDK -ISFML\include -ILua\src -Iglew-1.5.7\include -Iboost_1_47_0  -c C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.cpp -o obj\WinDebug\Classes.o

C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:49:23: error: wx/wxprec.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:57:19: error: wx/wx.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:60:65: error: wx/glcanvas.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:61:25: error: wx/imaglist.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:62:25: error: wx/treectrl.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:63:25: error: wx/listctrl.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:64:25: error: wx/aboutdlg.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:65:25: error: wx/wfstream.h: No such file or directory
C:\Users\Tristan\CodeBlocksProjects\SurrealDK\Classes.hpp:66:34: error: wx/propgrid/propgrid.h: No such file or directory
Wait, so it's not actually calling wx-config, nor inserting the results of it, even though it's sitting right there in my Build Options -> Compiler Settings -> Other Options list? That's very strange...

*sigh* This works fine on Linux, and I've always had a pain with it on Windows. But it's not like I can just not make a Windows build, since most of the people who would be using it are running Windows.

Re: wx-config not executing.

Posted: Thu Jul 28, 2011 12:22 pm
by Auria
Code::Blocks, as far as I know, is not really designed to work with Cygwin. By default it uses standard mingw, no cygwin. So either you switch your wxWidgets build to use plain mingw, no cygwin, either you convince C::B to use Cygwin (don't ask me how though)

Re: wx-config not executing.

Posted: Thu Jul 28, 2011 3:27 pm
by ouch67
No you can do it you just have to go to settings->compiler and debugger->toolchain executables and change the directory and files to the msys ones.

Just keep in mind that msys and cygwin are emulations of a linux terminal. meaning, not all scripts will work. I didn't like either one of them when I tried them before. It was awhile ago now, maybe they improved them by now.

But the wxwidgets project wizard sets up wxsmith and all the libs anyway so there really is no use for wx-config in a windows environment with codeblocks.

Re: wx-config not executing.

Posted: Thu Jul 28, 2011 3:45 pm
by drummerp
ouch67 wrote:No you can do it you just have to go to settings->compiler and debugger->toolchain executables and change the directory and files to the msys ones.

Just keep in mind that msys and cygwin are emulations of a linux terminal. meaning, not all scripts will work. I didn't like either one of them when I tried them before. It was awhile ago now, maybe they improved them by now.

But the wxwidgets project wizard sets up wxsmith and all the libs anyway so there really is no use for wx-config in a windows environment with codeblocks.
The wxWidgets Project Wizard wasn't applicable here because it wasn't until about halfway through my project that I even decided to use wxWidgets, and it is not in any way practical to make a new project for this.

Thank you, though, so much. So, I'm assuming that then I'll need to install GCC using MSYS for this to be able to work?

Re: wx-config not executing.

Posted: Thu Jul 28, 2011 4:28 pm
by ouch67
you can use msys and mingw, but you need to change your path and executables to use msys.

otherwise you can give cygwin a try, I found that to be a bit better than msys anyway. plus codeblocks can auto detect that so there is no manual setup like with msys.

Re: wx-config not executing.

Posted: Fri Jul 29, 2011 2:18 am
by drummerp
ouch67 wrote:you can use msys and mingw, but you need to change your path and executables to use msys.

otherwise you can give cygwin a try, I found that to be a bit better than msys anyway. plus codeblocks can auto detect that so there is no manual setup like with msys.
Well, at any rate, I managed to create a new wxWidgets project in CodeBlocks and then copy over a lot of my code and other external projects. So hopefully I can get that to work. The problem is, that the past few times I've tried to compile this project for Windows, it's seemed that wxWidgets relies on a lot of Win32 libraries (which is not surprising), and that I've gotten a bunch of linker errors which were obviously from Win32 (this was corroborated by googling the function library), the only solution to which was to manually add each library into my linker options, which just created a mess (and nearly doubled my executable size because my debug configuration uses all static libraries). I was hoping that using wx-config would help that as it did in Linux.

Re: wx-config not executing.

Posted: Fri Jul 29, 2011 3:03 am
by drummerp
Actually, using the wxWidgets project wizard did fix most of the problems. I only have two different problems: One is with GLEW, so if I can't figure it out I'll probably ask it on some forums which are actually relevant to GLEW; the second is a bunch of "undefined reference to _Unwind_Resume". I don't know what that's a problem with (or whether it is a wxWidgets thing or not), so I'm going to ask here and pray someone might know. If not, I'll find somewhere else to ask.

Re: wx-config not executing.

Posted: Fri Jul 29, 2011 3:57 pm
by ouch67
_Unwind_Resume is part of gcc's library. You should uninstall the mingw version you have and install TDM mingw. It doesn't require any external libraries, as apposed to the "official" mingw which does.

Re: wx-config not executing.

Posted: Fri Jul 29, 2011 4:12 pm
by drummerp
ouch67 wrote:_Unwind_Resume is part of gcc's library. You should un-install the mingw version you have and install TDM mingw. It doesn't require any external libraries, as opposed to the "official" mingw which does.
Ah, yes, I already did that (realised the errors were coming from another library I was using, asked there, was told to install TDM), but thank you for confirming that. Give me a minute, and I'll be able to tell you if it fixed it.

EDIT: It worked. All I have left to fix is some GLEW stuff, and then my program should work. Thank you so much for your help, I really do appreciate it.

Re: wx-config not executing.

Posted: Thu Aug 25, 2011 2:25 pm
by soundwiz
Hello - I'm stuck with the same problem. Sort of.

I'm using the CodeBlocks environment and the TDM MinGW32 builder in Windows 7. But I don't realize what libaries to get rid of.
I'v started out with a Wizard Frame project (did that yesterday on my Linux machine - no problems whatsoever).
When I build, I get all these "undefined reference to _Unwind_Resume"
But if I remove mingw-runtime and/or w32api I get missing files errors instead.

What to do?
Per