I am learning principles and practices using C ++, and I am having problems linking to the proper architecture. I am currently using an Apple computer, my compiler is gcc version 4.2.1 (based on Apple Inc. build 5658) (LLVM build 2336.1.00) when I
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
in which I have both architectures / libraries available here, which I use to compile my program
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
It seems that the library I'm using libbookgui.a is not compiled into the correct architecture, but I could be wrong.
when I check in which architecture the lib file is created, I get:
/usr/local/lib/libbookgui.a: current ar archive random library