ld:找不到架构x86_64的符号

时间:2011-10-21 20:17:12

标签: c++ macos gcc

我正在使用C ++学习原理和实践,并且遇到了与我正在使用Apple计算机的正确架构有关的问题,我的编译器是gcc版本4.2.1(基于Apple Inc. build 5658)(LLVM构建) 2336.1.00) 当我

file /usr/lib/libffi.dylib

/usr/lib/libffi.dylib: Mach-O universal binary with 2 architectures                                                                                                                                         
/usr/lib/libffi.dylib (for architecture x86_64):        Mach-O 64-bit dynamically linked shared library x86_64                                                                                              
/usr/lib/libffi.dylib (for architecture i386):  Mach-O dynamically linked shared library i386

我在这里有两个架构/库可用于编译我的程序

    g++ -Wall chapter.12.3.cpp -o chapter.12.3 


In file included from GUI.h:11,                                                                                                                                                                             
                 from Simple_window.h:10,                                                                                                                                                                   
                 from chapter.12.3.cpp:7:                                                                                                                                                                   
Graph.h: In constructor ‘Graph_lib::Color::Color(Graph_lib::Color::Color_type)’:                                                                                                                            
Graph.h:56: warning: ‘Graph_lib::Color::c’ will be initialized after                                                                                                                                        
Graph.h:55: warning:   ‘char Graph_lib::Color::v’                                                                                                                                                           
Graph.h:45: warning:   when initialized here                                                                                                                                                                
Graph.h: In constructor ‘Graph_lib::Color::Color(Graph_lib::Color::Color_type, Graph_lib::Color::Transparency)’:                                                                                            
Graph.h:56: warning: ‘Graph_lib::Color::c’ will be initialized after                                                                                                                                        
Graph.h:55: warning:   ‘char Graph_lib::Color::v’                                                                                                                                                           
Graph.h:46: warning:   when initialized here                                                                                                                                                                
Graph.h: In constructor ‘Graph_lib::Color::Color(int)’:                                                                                                                                                     
Graph.h:56: warning: ‘Graph_lib::Color::c’ will be initialized after                                                                                                                                        
Graph.h:55: warning:   ‘char Graph_lib::Color::v’                                                                                                                                                           
Graph.h:47: warning:   when initialized here                                                                                                                                                                
Graph.h: In constructor ‘Graph_lib::Color::Color(Graph_lib::Color::Transparency)’:                                                                                                                          
Graph.h:56: warning: ‘Graph_lib::Color::c’ will be initialized after                                                                                                                                        
Graph.h:55: warning:   ‘char Graph_lib::Color::v’                                                                                                                                                           
Graph.h:48: warning:   when initialized here                                                                                                                                                                
Graph.h: In constructor ‘Graph_lib::Rectangle::Rectangle(Point, int, int)’:                                                                                                                                 
Graph.h:211: warning: ‘Graph_lib::Rectangle::w’ will be initialized after                                                                                                                                   
Graph.h:210: warning:   ‘int Graph_lib::Rectangle::h’                                                                                                                                                       
Graph.h:194: warning:   when initialized here                                                                                                                                                               
Graph.h: In constructor ‘Graph_lib::Rectangle::Rectangle(Point, Point)’:                                                                                                                                    
Graph.h:211: warning: ‘Graph_lib::Rectangle::w’ will be initialized after                                                                                                                                   
Graph.h:210: warning:   ‘int Graph_lib::Rectangle::h’                                                                                                                                                       
Graph.h:200: warning:   when initialized here                                                                                                                                                               
In file included from Simple_window.h:10,                                                                                                                                                                   
                 from chapter.12.3.cpp:7:                                                                                                                                                                   
GUI.h: In member function ‘virtual void Graph_lib::Menu::show()’:                                                                                                                                           
GUI.h:107: warning: comparison between signed and unsigned integer expressions                                                                                                                              
GUI.h: In member function ‘virtual void Graph_lib::Menu::hide()’:                                                                                                                                           
GUI.h:112: warning: comparison between signed and unsigned integer expressions                                                                                                                              
GUI.h: In member function ‘virtual void Graph_lib::Menu::move(int, int)’:                                                                                                                                   
GUI.h:117: warning: comparison between signed and unsigned integer expressions                                                                                                                              
Graph.h: In destructor ‘Graph_lib::Vector_ref<T>::~Vector_ref() [with T = Graph_lib::Button]’:                                                                                                              
GUI.h:96:   instantiated from here                                                                                                                                                                          
Graph.h:130: warning: comparison between signed and unsigned integer expressions                                                                                                                            
Undefined symbols for architecture x86_64:                                                                                                                                                                  
  "Simple_window::Simple_window(Point, int, int, String const&)", referenced from:                                                                                                                          
      _main in ccarbqNp.o                                                                                                                                                                                   
  "Graph_lib::Polygon::add(Point)", referenced from:                                                                                                                                                        
      _main in ccarbqNp.o                                                                                                                                                                                   
  "Simple_window::wait_for_button()", referenced from:                                                                                                                                                      
      _main in ccarbqNp.o                                                                                                                                                                                   
  "Graph_lib::Shape::Shape()", referenced from:                                                                                                                                                             
      Graph_lib::Open_polyline::Open_polyline()in ccarbqNp.o                                                                                                                                                
  "vtable for Graph_lib::Open_polyline", referenced from:  
Graph_lib::Open_polyline::Open_polyline()in ccarbqNp.o                                                                                                                                                
  "vtable for Graph_lib::Open_polyline", referenced from:                                                                                                                                                   
      Graph_lib::Open_polyline::Open_polyline()in ccarbqNp.o                                                                                                                                                
      Graph_lib::Open_polyline::~Open_polyline()in ccarbqNp.o                                                                                                                                               
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.                                                                                                      
  "vtable for Graph_lib::Closed_polyline", referenced from:                                                                                                                                                 
      Graph_lib::Closed_polyline::Closed_polyline()in ccarbqNp.o                                                                                                                                            
      Graph_lib::Closed_polyline::~Closed_polyline()in ccarbqNp.o                                                                                                                                           
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.                                                                                                      
  "vtable for Graph_lib::Polygon", referenced from:                                                                                                                                                         
      Graph_lib::Polygon::Polygon()in ccarbqNp.o                                                                                                                                                            
      Graph_lib::Polygon::~Polygon()in ccarbqNp.o                                                                                                                                                           
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.                                                                                                      
  "vtable for Graph_lib::Shape", referenced from:                                                                                                                                                           
      Graph_lib::Shape::~Shape()in ccarbqNp.o                                                                                                                                                               
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.                                                                                                      
  "vtable for Graph_lib::Button", referenced from:                                                                                                                                                          
      Graph_lib::Button::~Button()in ccarbqNp.o                                                                                                                                                             
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.                                                                                                      
  "vtable for Graph_lib::Window", referenced from:                                                                                                                                                          
      Graph_lib::Window::~Window()in ccarbqNp.o                                                                                                                                                             
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.                                                                                                      
  "Fl_Window::~Fl_Window()", referenced from:                                                                                                                                                               
      Graph_lib::Window::~Window()in ccarbqNp.o                                                                                                                                                             
  "Graph_lib::Window::draw()", referenced from:                                                                                                                                                             
      vtable for Simple_windowin ccarbqNp.o                                                                                                                                                                 
  "Fl_Window::handle(int)", referenced from:                                                                                                                                                                
      vtable for Simple_windowin ccarbqNp.o                                                                                                                                                                 
  "Fl_Window::resize(int, int, int, int)", referenced from:                                                                                                                                                 
      vtable for Simple_windowin ccarbqNp.o                                                                                                                                                                 
  "Fl_Window::show()", referenced from:                                                                                                                                                                     
      vtable for Simple_windowin ccarbqNp.o                                                                                                                                                                 
  "Fl_Window::hide()", referenced from:                                                                                                                                                                     
      vtable for Simple_windowin ccarbqNp.o                                                                                                                                                                 
  "Fl_Window::flush()", referenced from:                                                                                                                                                                    
      vtable for Simple_windowin ccarbqNp.o                                                                                                                                                                 
  "typeinfo for Graph_lib::Window", referenced from:                                                                                                                                                        
      typeinfo for Simple_windowin ccarbqNp.o                                                                                                                                                               
ld: symbol(s) not found for architecture x86_64                                                                                                                                                             
collect2: ld returned 1 exit status                                                                                                                                                                         

Compilation exited abnormally with code 1 at Fri Oct 21 12:48:23 
似乎我使用libbookgui.a的库没有编译到正确的架构,但我可能是不正确的。

当我检查lib文件构建的内容时,我得到:

/usr/local/lib/libbookgui.a: current ar archive random library 

0 个答案:

没有答案