简体   繁体   English

install wx-widgets在优胜美地上让我发疯

[英]install wx-widgets is driving me insane on Yosemite

I'm on Mac OS X Yosemite 10.10.2. 我在Mac OS X Yosemite 10.10.2上。 As far as I know, wx-widgets were preinstalled on older versions on OS X (probably that's why google search doesn't help), but that's not the case anymore. 据我所知,wx-widgets已预先安装在OS X的旧版本上(这可能是Google搜索无济于事的原因),但事实并非如此。 I need to get started on a C++ project using wx-widgets, using any IDE (Eclipse, Codelite, or whatever is best). 我需要使用wx-widgets,任何IDE(Eclipse,Codelite或最好的东西)来开始C ++项目。 However, I simply cannot get wx-widgets to work. 但是,我根本无法使wx-widgets工作。 After a workaround I was able to compile on my machine wxWidgets-3.0.2. 解决后,我可以在我的机器上编译wxWidgets-3.0.2。 I called from terminal make and make install, but the libraries seem to not be correctly installed. 我从终端make和make install调用,但是库似乎未正确安装。 Indeed, if I create a project on Codelite I get many "wx-config: Command not found" errors. 确实,如果我在Codelite上创建项目,则会收到许多“ wx-config:找不到命令”错误。 Can someone help me to get me started on installing the libraries and creating a simple project that includes wx-widgets? 有人可以帮助我让我开始安装库并创建一个包含wx-widgets的简单项目吗?

I use homebrew which is installed by copying and pasting one line from the homebrew website . 我使用homebrew ,它是通过从homebrew网站复制并粘贴一行来安装的。

Then, the installation of wxWidgets is simplicity itself with: 然后,wxWidgets的安装本身很简单:

brew install wxmac

Any problems, you just call the doctor with 有任何问题,您只需打电话给医生

brew doctor

Now you have a proper package manager you can install ImageMagick, GNU Parallel, GNU awk, Oxygen, webkit2html, zeromq, tree, SDL, Redis, sqlitebrowser, pandoc, exiftool, ffmpeg, 7zip, awscli, etc... 现在您有了合适的软件包管理器,可以安装ImageMagick,GNU Parallel,GNU awk,Oxygen,webkit2html,zeromq,tree,SDL,Redis,sqlitebrowser,pandoc,exiftool,ffmpeg,7zip,awscli等。

You can then compile your wxWidgets programs with 然后,您可以使用以下命令编译wxWidgets程序

g++ `wx-config --cxxflags` -o sample sample.cpp `wx-config --libs`

I can successfully compile and install wxWidgets on Yosemite with these commands: 我可以使用以下命令在优胜美地上成功编译并安装wxWidgets:

- Get the latest sources of wxWidgets 3 from wxwidgets.org and unpack them.
- Move the unpacked directory someplace where you want to keep it.
- Open a terminal and change into the wxwidgets directory.
- Create two directories: build-release and build-debug (don't rename those!)
- Change into wxwidgets/build-release
- Run 
  ../configure --with-osx_cocoa --disable-shared --with-opengl --enable-universal-binary=i386,x86_64 --with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk --with-macosx-version-min=10.6
- Run make, then sudo make install
- Change into wxwidgets/build-debug
- Run 
  ../configure --enable-debug --with-osx_cocoa --with-opengl --enable-universal-binary=i386,x86_64 --with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk --with-macosx-version-min=10.6
- Run make, then sudo make install

Be aware that these instructions are for compiling against the Mac OS X 10.6 SDK, which I have at /Developer/SDKs/MacOSX10.6.sdk . 请注意,这些说明是针对我在/Developer/SDKs/MacOSX10.6.sdk的Mac OS X 10.6 SDK进行编译的。 You can try to omit the --with-macosx-sdk parameter altogether, which will compile using the latest SDK. 您可以尝试完全省略--with-macosx-sdk参数,该参数将使用最新的SDK进行编译。 Also ensure that you have Xcode and the command line developer tools installed. 还要确保您已安装Xcode和命令行开发人员工具。

These commands will install static libraries for the release build and shared libraries for the debug build. 这些命令将为发布版本安装静态库,为调试版本安装共享库。 You can change this by supplying or omitting the --disable-shared parameter. 您可以通过提供或忽略--disable-shared参数来更改此设置。

The instructions for building and installing wxWidgets are included in the distribution and can also be viewed online . 发行版中包含用于构建和安装wxWidgets的说明,也可以在线查看。

If your IDE doesn't find wx-config , you must not have the location where you installed it ( /usr/local/bin ) by default in your PATH . 如果您的IDE找不到wx-config ,则默认情况下,您的PATH必须没有安装它的位置( /usr/local/bin )。 Add it there to fix this. 在此处添加它以解决此问题。

Like suggested by VZ, you must change your PATH. 就像VZ所建议的那样,您必须更改PATH。

But not the variable PATH in your environment Windows but the variable PATH in your C++ project. 但不是环境Windows中的变量PATH,而是C ++项目中的变量PATH。 It's strange but maybe it's different. 这很奇怪,但也许有所不同。

Go into (for eclipse) : C/C++Build->Environment->PATH (add the path of wx-config in the beginning). 进入(针对Eclipse):C / C ++ Build-> Environment-> PATH(在开头添加wx-config的路径)。

Press : Apply, OK and build the project. 按:应用,确定,然后生成项目。

I think is strange that Eclipse don't update the PATH after rebooting the OS. 我认为奇怪的是,Eclipse在重启操作系统后没有更新PATH。 Maybe we must add an option to Eclipse for building WxWidget and force Eclipse to update the PATH, but I don't know it. 也许我们必须为Eclipse添加一个选项以构建WxWidget,并强制Eclipse更新PATH,但是我不知道。

This change work for me. 这种变化对我有用。

Eclipse / MinGW-MSYS / WxWidget 2.8 Eclipse / MinGW-MSYS / WxWidget 2.8

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM