Snow Leopard 上的 wxWidgets 问题

发布于 2024-10-08 13:19:31 字数 1371 浏览 0 评论 0原文

我在编译 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

山色无中 2024-10-15 13:19:31

我通过将新 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.

哭了丶谁疼 2024-10-15 13:19:31

令我惊讶的是,当默认安装前缀为 /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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文