开发者

Problem with wxWidgets on Snow Leopard

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

OBJ开发者_StackOverflow中文版ECTS = $(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)

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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜