Menu

Error compiling example on OSX 1.7.3

Help
2012-05-09
2012-10-16
  • Michael Dzjaparidze

    Hi,

    I am trying to compile the first example from the documentation: 2.1.1 Using
    MathGL window on Mac OSX 10.7.3 (Lion), but when I try

    g++ example.cpp -o example

    I get the following error:

    Undefined symbols for architecture x86_64:
    "_mgl_set_font_size", referenced from:
    mglGraph::SetFontSize(float) in ccPc8wMp.o
    "_mgl_create_graph_gl", referenced from:
    mglGraph::mglGraph(int, int, int)in ccPc8wMp.o
    "_mgl_create_graph", referenced from:
    mglGraph::mglGraph(int, int, int)in ccPc8wMp.o
    "_mgl_use_graph", referenced from:
    mglGraph::~mglGraph()in ccPc8wMp.o
    mglGraph::~mglGraph()in ccPc8wMp.o
    mglGraph::~mglGraph()in ccPc8wMp.o
    "_mgl_delete_graph", referenced from:
    mglGraph::~mglGraph()in ccPc8wMp.o
    mglGraph::~mglGraph()in ccPc8wMp.o
    mglGraph::~mglGraph()in ccPc8wMp.o
    "mgl_draw_graph(mglBase, void)", referenced from:
    mglWindow::mglWindow(int ()(mglGraph), char const, int)in ccPc8wMp.o
    "_mgl_create_graph_qt", referenced from:
    mglWindow::mglWindow(int (
    )(mglGraph), char const, int)in ccPc8wMp.o
    "_mgl_create_graph_fltk", referenced from:
    mglWindow::mglWindow(int ()(mglGraph), char const, int)in ccPc8wMp.o
    "_mgl_qt_run", referenced from:
    mglWindow::Run() in ccPc8wMp.o
    "_mgl_fltk_run", referenced from:
    mglWindow::Run() in ccPc8wMp.o
    "_mgl_rotate", referenced from:
    mglGraph::Rotate(float, float, float)in ccPc8wMp.o
    "_mgl_box_str", referenced from:
    mglGraph::Box(char const
    , bool)in ccPc8wMp.o
    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status

    I am just starting out with c++, so I can't really make sense of this. If
    someone could possibly tell me what might be going wrong, then I would be very
    grateful for that.

    Thanks

    Michael

     
  • Michael Dzjaparidze

    After browsing the forum a bit I suspect that I need to set some options (QT,
    FLTK etc.) during compilation. I'll give this a try. Apologies for the
    (possible) fuss.

     
  • Alexey Balakin

    Alexey Balakin - 2012-05-10

    You need to enable Qt and FLTK options if you plan to use windows/widgets. In
    yours case it look as you forgot to add linker option -lmgl for linking MathGL
    library.

     

Log in to post a comment.