Snow Leopard 上的 wxWidgets 问题
我在编译 wxWidget 应用程序时遇到问题。我已经安装了该库的最新版本,如下所示:
set arch_flags="-arch x86_64 "
./configure -with-osx_cocoa --disable-shared --disable-compat24 --enable-unicode --enable-universal-binary CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags"
sudo make install
我正在尝试编译一个简单的 hello-world 示例:
WXWIDGETS = -I/usr/local/include/wx-2.9/
CXXFLAGS = -O2 -g -Wall -Wextra -fmessage-length=0
CXX = $(shell wx-config --cxx)
PROGRAM = wxProjectExample
OBJECTS = $(PROGRAM).o
# implementation
.SUFFIXES: .o .cpp
.cpp.o :
$(CXX) -c `wx-config --static=yes --libs` `wx-config --static=yes --cxxflags` -o $@ $<
all: $(PROGRAM)
$(PROGRAM): $(OBJECTS)
$(CXX) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
clean:
rm -f *.o $(PROGRAM)
但是链接时编译失败:
ld: warning: in /System/Library/Frameworks//QuickTime.framework/QuickTime, missing required architecture x86_64 in file
ld: warning: in /usr/lib/libwx_macud-2.8.dylib, missing required architecture x86_64 in file
Undefined symbols:
"wxWindowBase::DoSetVirtualSize(int, int)", referenced from:
vtable for MyFramein wxProjectExample.o
哪里可能有问题或者有人对此框架有类似的问题?
谢谢。
聚苯乙烯 系统:SnowLeopard(64 位)10.6.5。使用英特尔处理器,gcc 4.2。
I have a problem with getting compiled an wxWidget-application. I have installed the latest version of the library as follows:
set arch_flags="-arch x86_64 "
./configure -with-osx_cocoa --disable-shared --disable-compat24 --enable-unicode --enable-universal-binary CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags"
sudo make install
I'am trying to compile a simple hello-world example with:
WXWIDGETS = -I/usr/local/include/wx-2.9/
CXXFLAGS = -O2 -g -Wall -Wextra -fmessage-length=0
CXX = $(shell wx-config --cxx)
PROGRAM = wxProjectExample
OBJECTS = $(PROGRAM).o
# implementation
.SUFFIXES: .o .cpp
.cpp.o :
$(CXX) -c `wx-config --static=yes --libs` `wx-config --static=yes --cxxflags` -o $@ lt;
all: $(PROGRAM)
$(PROGRAM): $(OBJECTS)
$(CXX) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
clean:
rm -f *.o $(PROGRAM)
But the compilation fails while linking with:
ld: warning: in /System/Library/Frameworks//QuickTime.framework/QuickTime, missing required architecture x86_64 in file
ld: warning: in /usr/lib/libwx_macud-2.8.dylib, missing required architecture x86_64 in file
Undefined symbols:
"wxWindowBase::DoSetVirtualSize(int, int)", referenced from:
vtable for MyFramein wxProjectExample.o
Where could be a problem or have somebody had similar problems with this framework?
Thx.
PS
System: SnowLeopard (64 bit) 10.6.5. with an intel proc, gcc 4.2.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我通过将新 wx-binaries 的路径添加到 PATH 解决了这个问题
$ export PATH=/usr/local/Cellar/wxmac/2.8.11/bin:$PATH
我正在使用brew来安装wxmac。
i fixed this problem by adding the path to the new wx-binaries to PATH
$ export PATH=/usr/local/Cellar/wxmac/2.8.11/bin:$PATH
i'm using brew to install wxmac.
令我惊讶的是,当默认安装前缀为
/usr/local
时,/usr/lib
中却有libwx_xxx
。您确定系统上没有多个不兼容的库版本吗?此外,当使用静态链接时,包含代码依赖项的库必须位于引用它们的目标文件之后,因此
wx-config --libs
部分应位于末尾你的统治。I'm surprised that you have
libwx_xxx
in/usr/lib
when the default installation prefix is/usr/local
. Are you sure you don't have multiple incompatible libraries versions on your system?Also, when using static linking the libraries containing the dependencies of your code must come after the object file referencing them so the
wx-config --libs
part should be at the end of your rule.