我正在帮助一位朋友在OSX上测试hiis代码但是当我开始链接时我得到了这个错误:
Linking CXX executable rme
Undefined symbols for architecture x86_64:
"BrowseTileWindow::BrowseTileWindow(wxWindow*, Map const*, Tile*, wxPoint)", referenced from:
MapCanvas::OnBrowseTile(wxCommandEvent&) in map_display.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [rme] Error 1
make[1]: *** [CMakeFiles/rme.dir/all] Error 2
make: *** [all] Error 2
我甚至不确定代码的哪一部分会产生错误,但据我所知,它来自这两个方面:
我不确定这里的代码是否是错误中提到的但是我无法在代码中找到该特定行(此代码位于新的.cpp文件中):
BrowseTileWindow::BrowseTileWindow(wxWindow* parent, const Map* map, Tile* tile, wxPoint position /* = wxDefaultPosition */) :
wxDialog(parent, wxID_ANY, "Browse Field", position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER)
{
wxSizer* sizer = newd wxBoxSizer(wxVERTICAL);
item_list = newd BrowseTileListBox(this, wxID_ANY, tile);
sizer->Add(item_list, wxSizerFlags(1).Expand());
wxString pos;
pos << wxT("x=") << tile->getX() << wxT(", y=") << tile->getY() << wxT(", z=") << tile->getZ();
wxSizer* infoSizer = newd wxBoxSizer(wxVERTICAL);
infoSizer->Add(newd wxStaticText(this, wxID_ANY, wxT("Position: ") + pos), wxSizerFlags(0).Center());
infoSizer->Add(newd wxStaticText(this, wxID_ANY, wxT("Item count: ") + i2ws(item_list->GetItemCount())), wxSizerFlags(0).Left());
sizer->Add(infoSizer, wxSizerFlags(0).Center().DoubleBorder());
SetSizerAndFit(sizer);
}
引自map_display.cpp(这是已添加的代码):
void MapCanvas::OnBrowseTile(wxCommandEvent& WXUNUSED(event))
{
if (editor.selection.size() != 1)
return;
Tile* tile = editor.selection.getSelectedTile();
if (!tile) return;
ASSERT(tile->isSelected());
wxDialog* w = new BrowseTileWindow(gui.root, &editor.map, tile, wxPoint(cursor_x, cursor_y));
w->ShowModal();
w->Destroy();
}
我知道此网站之前已经有人问过这个问题,但是我找不到任何可以解决我问题的方法。感谢任何帮助,谢谢!