操作系统:MAC X 10.7.0
Mac OS X在/ usr中安装了较旧版本的wxMac(wxMac-2.8.8.1),但我在/ usr / local中安装了较新版本(wxMac-2.8.12.0)。要安装它,我用标志编译新的:
arch_flags =“ - arch i386” ./configure CFLAGS =“$ arch_flags”CXXFLAGS =“$ arch_flags”CPPFLAGS =“$ arch_flags”LDFLAGS =“$ arch_flags”OBJCFLAGS =“$ arch_flags”OBJCXXFLAGS =“$ arch_flags”--enable-unicode --enable-debug - -disable共享
然后我编写一个简单的程序(hello2.cpp)来测试它:
#include "wx/wx.h"
class HelloWorldApp : public wxApp
{
public:
virtual bool OnInit();
private:
wxButton *button;
};
IMPLEMENT_APP(HelloWorldApp)
bool HelloWorldApp::OnInit()
{
wxFrame *frame = new wxFrame((wxFrame*) NULL, -1, _T("Hello wxWidgets World"));
frame->CreateStatusBar();
frame->SetStatusText(_T("Hello World"));
button = new wxButton((wxFrame *)frame, -2, _T("123"));
frame->Show(TRUE);
SetTopWindow(frame);
return true;
}
我在命令行中使用标志:
编译此测试程序 g ++ hello2.cpp /usr/local/bin/wx-config --cxxflags --libs
-o hello2
但我收到一些警告和错误。我是Mac编程的新手,所以我不知道原因。我只想说:帮助!
以下是编译的结果:
ld:警告:在/usr/local/lib/libiconv.dylib中,文件是为不支持的文件格式构建的,而不是所链接的体系结构(i386) 未定义的符号: “_libiconv_open”,引自: libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv :: wxMBConv_iconv(wchar_t const *) libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv :: wxMBConv_iconv(wchar_t const *) libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv :: wxMBConv_iconv(wchar_t const *) libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv :: wxMBConv_iconv(wchar_t const *) libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv :: wxMBConv_iconv(wchar_t const *) libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv :: wxMBConv_iconv(wchar_t const *) libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv :: wxMBConv_iconv(wchar_t const *) libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv :: wxMBConv_iconv(wchar_t const *) “_libiconv”,引自: 在libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv :: GetMBNulLen()const wxMBConv_iconv :: WC2MB(char *,wchar_t const *,unsigned long)constin libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv :: WC2MB(char *,wchar_t const *,unsigned long)constin libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv :: MB2WC(wchar_t *,char const *,unsigned long)constin libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv :: MB2WC(wchar_t *,char const *,unsigned long)constin libwx_base_carbonud-2.8.a(baselib_strconv.o) libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv :: wxMBConv_iconv(wchar_t const *) libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv :: wxMBConv_iconv(wchar_t const *) “_libiconv_close”,引自: libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv ::〜wxMBConv_iconv() libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv ::〜wxMBConv_iconv() libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv ::〜wxMBConv_iconv() libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv ::〜wxMBConv_iconv() libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv ::〜wxMBConv_iconv() libwx_base_carbonud-2.8.a(baselib_strconv.o)中的wxMBConv_iconv ::〜wxMBConv_iconv() ld:找不到符号 collect2:ld返回1退出状态
答案 0 :(得分:0)
我卸载了wxMac-2.8.12。 我安装了wxWidgets-2.9.2(./ configure --enable-unicode --enable-debug --disable-shared)
我用g ++ hello2.cpp`/ usr / local / bin / wx-config --cxxflags --libs` -o hello2再次编译测试程序。只有一个警告:
ld:警告:在/System/Library/Frameworks//QuickTime.framework/QuickTime中,缺少文件中所需的架构x86_64
我认为没关系。