Author Topic: wxWidgets on OS-X no work!  (Read 6472 times)

Offline Neal M

  • Multiple posting newcomer
  • *
  • Posts: 14
wxWidgets on OS-X no work!
« on: January 14, 2019, 03:57:29 am »
Whenever I try to make a wxWidgets project, Code::Blocks gives me a crap load of compiler errors just trying to run the default Hello World (errors in attached text file).

I inquired over on the wxWidgets forum and was told that I appear to have built the wx package correctly and the issue is apparently that Code::Blocks isn't configured properly to work with wxWidgets.

I'm using C::B 13.12 (the latest version available for OS X) and wxWidgets 3.0.4 on OS X 10.13.2 (High Sierra).
« Last Edit: January 16, 2019, 11:43:34 pm by Neal M »

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: wxWidgets on OS-X no work!
« Reply #1 on: January 14, 2019, 04:29:45 am »
So, what is the output of wx-config from the command line?

Code
wx-config --list

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Neal M

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: wxWidgets on OS-X no work!
« Reply #2 on: January 14, 2019, 05:32:52 am »
I can't get the wx-config script to run, that's my other problem.

Quote
Neals-MacBook-Pro:wxwidgets-3.0.4 Neal1$ ls wx*
wx-config-inplace.in   wx-config.in      wxwin.m4
Neals-MacBook-Pro:wxwidgets-3.0.4 Neal1$ wx-config --list
-bash: wx-config: command not found
Neals-MacBook-Pro:wxwidgets-3.0.4 Neal1$ wx-config.in --list
-bash: wx-config.in: command not found
Neals-MacBook-Pro:wxwidgets-3.0.4 Neal1$

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: wxWidgets on OS-X no work!
« Reply #3 on: January 14, 2019, 08:29:21 am »
This seems like the unpackaged source dir.
Probably you need to build the library first.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Neal M

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: wxWidgets on OS-X no work!
« Reply #4 on: January 15, 2019, 12:02:37 am »
Well I did the build procedure according to the installation instructions.
The sample apps all seem to work, which suggests that the build went okay, at least that's what I was told in the wxWidgets forum.

I don't know what else do.

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: wxWidgets on OS-X no work!
« Reply #5 on: January 15, 2019, 01:47:32 am »
Install your build.

Offline Neal M

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: wxWidgets on OS-X no work!
« Reply #6 on: January 15, 2019, 09:58:19 pm »
Install your build.

Well if I knew how to do that I wouldn't need to be asking for help here. Can you tell me how this is done?

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: wxWidgets on OS-X no work!
« Reply #7 on: January 15, 2019, 11:00:22 pm »
If you built the source tarball using the usual configure && make it is

Code
sudo make install

or whatever OS-X uses as command to become root.

Offline Neal M

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: wxWidgets on OS-X no work!
« Reply #8 on: January 16, 2019, 01:05:24 am »
OKay, I tried sudo make install, and it spat out a bunch of text, said it had installed, C::B is still not happy. The wx-config script runs now though.

Quote
Neals-MacBook-Pro:wxwidgets-3.0.4 Neal1$ wx-config --list

    Default config is osx_cocoa-unicode-3.0

  Default config will be used for output

And

Quote
Neals-MacBook-Pro:wxwidgets-3.0.4 Neal1$ wx-config --cppflags
-I/usr/local/lib/wx/include/osx_cocoa-unicode-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: wxWidgets on OS-X no work!
« Reply #9 on: January 16, 2019, 01:32:40 am »
Now you need to post a full Code::Blocks rebuild log.
http://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

And, hopefully someone will see the cause of C::B build problem.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Neal M

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: wxWidgets on OS-X no work!
« Reply #10 on: January 16, 2019, 02:14:01 am »
Here's the rebuild log:

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: wxWidgets on OS-X no work!
« Reply #11 on: January 16, 2019, 03:11:09 am »
Try adding these defines to your project. Note, the better option would be using wx-config in your project settings; but, I am guessing you do not wish to do that.  Tim S.

Code
_FILE_OFFSET_BITS=64 
WXUSINGDLL
__WXMAC__
__WXOSX__
__WXOSX_COCOA__

Edit: Add steps to add the defines.

Project -> Build Options
Tab: Compiler Settings
Sub-Tab: #defines
« Last Edit: January 16, 2019, 03:15:57 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Neal M

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: wxWidgets on OS-X no work!
« Reply #12 on: January 16, 2019, 08:50:54 am »
Well that produces a different set of errors, so I guess that's progress...

I'm open to trying the wx-config option, I'm just not very experienced with this sort of troubleshooting.
« Last Edit: January 16, 2019, 08:52:55 am by Neal M »

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: wxWidgets on OS-X no work!
« Reply #13 on: January 16, 2019, 09:25:06 am »
Can some Linux user walk the OP thru using wx-config in a project?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: wxWidgets on OS-X no work!
« Reply #14 on: January 16, 2019, 10:16:03 pm »
To use wxWidgets you have to supply the proper compiler and linker options. Because it is not so simple to just add the include directory and add one library you can use the wx-config script to get the required settings. You seem to have added some settings by yourself, remove these first.

Then go to the project settings and add under "Other compiler options"
Code
`wx-config --cxxflags`

and under "Other linker options"
Code
`wx-config --libs`

If you did build wxWidgets not as monolithic library but as individual libraries you can further restrict to link only to the libraries you actually use, but for this you need to check the wxWidgets documentation which ones you are actually using, a minimal GUI application at least requires this:
Code
`wx-config --libs core,base`
« Last Edit: January 16, 2019, 10:17:44 pm by sodev »