undefined symbols



  • Hi,

    ich habe noch nicht viel mit c++ gearbeitet und versuche gerade ein Programm zu compilieren, was aber leider nicht funktioniert. Ich arbeite mit einem Mac.
    Hier erstmal die Fehlermeldung:

    maggy:CancerSim praktikant$ make -f makefile2.txt
    g++ `wx-config --libs --gl-libs` -lstdc++ -framework GLUT -framework OpenGL -framework Foundation   GUI.o   -o GUI
    Undefined symbols:
      "Color_Key::Color_Key(wxWindow*, wxString const&, wxPoint const&)", referenced from:
          GUI::add_case()     in GUI.o
      "wxStringBase::InitWith(char const*, unsigned long, unsigned long)", referenced from:
          GUI::add_case()     in GUI.o
          GUI::add_case()     in GUI.o
      "Case::create(int, char**)", referenced from:
          GUI::add_case()     in GUI.o
      "Case::clone(Case*) const", referenced from:
          GUI::case_holder_duplicate(Case const*) in GUI.o
      "Case::set_palette(CancerSim::Palette const&)", referenced from:
          GUI::add_case()     in GUI.o
      "Case::Case(Case_Holder*, wxString const&, wxPoint const&, wxSize const&)", referenced from:
          GUI::add_case()     in GUI.o
      "wxApp::Initialize(int&, char**)", referenced from:
          vtable for GUIin GUI.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make: *** [GUI] Error 1
    

    Ich hab schon ein bisschen das Internet durchgeforstet und gemerkt, dass die Funktionen vllt. nicht initialisiert sind oder es irgendwas mit den Libraries zu tun hat, da kenn ich mich aber nicht so aus.

    Ich geb euch jetzt die Dateien dazu:
    GUI.cc

    #include "GUI.h"
    #include "Case.h"
    #include "Color_Key.h"
    #include "wx/bitmap.h"
    
    IMPLEMENT_APP(GUI)
    
    wxApp * theApp = &wxGetApp();
    
    bool GUI::OnInit()
    {
      add_case();
    
      return true;
    }
    
    Case * GUI::add_case()
    {
      int x, y;
    
      Case * c = new Case(this, "Cancer Grid", wxPoint(-1,-1), wxSize(600,400));
      c->create(argc, argv);
      c->GetPosition(&x, &y);
    
      Color_Key * colorkey = new Color_Key(c, "Key", wxPoint(x, y+420));
      colorkey->render();
      colorkey->Show();
      SetTopWindow(colorkey);
    
      c->set_palette(colorkey->palette());
      c->Show();
      SetTopWindow(c);
      return c;
    }
    
    void GUI::case_holder_duplicate(const Case * c)
    {
      Case * c2 = add_case();
      c->clone(c2);
    }
    

    Case.cc

    #include "Case.h"
    #include <vector>
    #include "wx/layout.h"
    #include "wx/sashwin.h"
    #include "Tissue_Parameters_Dialog.h"
    #include "sys/time.h"
    
    #undef Above
    #undef Below
    
    #define ID_0          10000
    #define ID_RUN        (ID_0+0)
    #define ID_DUPLICATE  (ID_0+1)
    #define ID_RESET      (ID_0+2)
    #define ID_JUMP_TIME  (ID_0+3)
    #define ID_DUAL_VIEW  (ID_0+4)
    #define ID_SCREENSHOT (ID_0+5)
    #define ID_SINGLE_STEP   (ID_0+6)
    #define ID_EDIT_SETTINGS (ID_0+7)
    #define ID_REDRAW_FREQUENCY (ID_0+8)
    
    BEGIN_EVENT_TABLE(Case, wxFrame)
     // EVT_SPLITTER_SASH_POS_CHANGED(-1, Case::OnSashPositionChange)
      EVT_SIZE(Case::OnSize)
      EVT_IDLE(Case::OnIdle)
      EVT_BUTTON(ID_RUN, Case::OnRunButton)
      EVT_BUTTON(ID_SINGLE_STEP, Case::OnSingleStepButton)
      EVT_BUTTON(ID_DUPLICATE, Case::OnDuplicateButton)
      EVT_BUTTON(ID_RESET, Case::OnResetButton)
      EVT_BUTTON(ID_JUMP_TIME, Case::OnJumpTimeButton)
      EVT_BUTTON(ID_DUAL_VIEW, Case::OnDualViewButton)
      EVT_BUTTON(ID_SCREENSHOT, Case::OnScreenshotButton)
      EVT_BUTTON(ID_EDIT_SETTINGS, Case::OnEditSettingsButton)
      EVT_BUTTON(ID_REDRAW_FREQUENCY, Case::OnEditRedrawFrequency)
    END_EVENT_TABLE()
    
    Case::Case(Case_Holder * holder, const wxString & title, const wxPoint & pos, const wxSize & size) :
      wxFrame(0, 107, title, pos, size),
      m_3d_views(0),
      m_history_view(0),
      m_running(false),
      m_holder(holder),
      m_jump_to_time(0),
      m_redraw_frequency(100),
      m_run_button(new wxButton(this, ID_RUN, "Run")),
      m_single_step_button(new wxButton(this, ID_SINGLE_STEP, "Single Step")),
      m_reset_button(new wxButton(this, ID_RESET, "Reset")),
      m_duplicate_button(new wxButton(this, ID_DUPLICATE, "Duplicate")),
      m_jump_time_button(new wxButton(this, ID_JUMP_TIME, "Jump Time")),
      m_dual_view_button(new wxButton(this, ID_DUAL_VIEW, "Dual View")),
      m_screenshot_button(new wxButton(this, ID_SCREENSHOT, "Screenshot")),
      m_redraw_frequency_button(new wxButton(this, ID_REDRAW_FREQUENCY, "Redraw Freq"))  
    {
      CreateStatusBar();
      // lay out the screen elements.
      const int gap = 5;
    
      std::vector<wxButton*> buttons;
      buttons.push_back(m_run_button);
      buttons.push_back(m_single_step_button);
      buttons.push_back(m_duplicate_button);
      buttons.push_back(m_reset_button);
      buttons.push_back(m_jump_time_button);
      buttons.push_back(m_dual_view_button);
      buttons.push_back(m_screenshot_button);
      buttons.push_back(new wxButton(this, ID_EDIT_SETTINGS, "Settings"));
      buttons.push_back(m_redraw_frequency_button);
    
      for(int i=0; i < buttons.size(); ++i)
      {
        wxLayoutConstraints * c = new wxLayoutConstraints;
        c->width.AsIs();
        c->height.AsIs();
        c->left.Absolute(gap);
        if(i)
          c->top.Below(buttons[i-1], gap);
        else
          c->top.Absolute(gap);
        buttons[i]->SetConstraints(c);
      }
      wxSplitterWindow * splitter = new wxSplitterWindow(this,-1);
      m_history_view = new History_View(splitter);
      m_3d_views = new Dual_3d_View(splitter);
    
      wxLayoutConstraints * c = new wxLayoutConstraints;
    
      #ifdef __WXMAC__
      c->left.RightOf(buttons[0], gap + 30);
      #else 
      c->left.RightOf(buttons[0], gap);
      #endif 
      c->top.Absolute(gap);
      c->right.SameAs(this, wxRight, gap);
      c->bottom.SameAs(this, wxBottom, gap);
      splitter->SetConstraints(c);
    
      SetAutoLayout(TRUE);
      Layout();
      splitter->SplitHorizontally(m_3d_views, m_history_view,0);
    }
    
    Case::~Case()
    {
    }
    
    void Case::create(int argc, char * argv[])
    {
      m_tissue.create(argc, argv);
    
      m_3d_views->create(&m_tissue);
      m_history_view->create(&m_tissue);
    
      update();
    }
    
    // This is a real hack for OSX
    void Case::OnSashPositionChange(int newSashPosition){
      int w, h;
      GetSize(&w, &h);
      SetSize(w+1, h+1);
    }
    
    // This is a real hack for OSX
    bool Case::Show(bool show)
    {
      wxPoint p = GetPosition();
      Move(0,0); Move(p);
      return wxFrame::Show(show);
    }
    
    // This is needed for OSX
    void Case::OnSize(wxSizeEvent& event)
    {
      wxFrame::OnSize(event);
      Show();
    }
    
    void Case::OnIdle(wxIdleEvent & event)
    {
      int i;
    
      if(m_running == false)
        return;
    
      const long checks_per_second = 2;
    
      timeval quitting_time;
      gettimeofday(&quitting_time, 0);
      quitting_time.tv_usec += 1000000 / checks_per_second;
    
      // normalize the quitting time.
      quitting_time.tv_sec += quitting_time.tv_usec / 1000000;
      quitting_time.tv_usec = quitting_time.tv_usec % 1000000;
    
      timeval now;
    
      int n = 0;
    
      while(1)
      {
        ++n;
        gettimeofday(&now, 0);
        if(now.tv_sec > quitting_time.tv_sec ||
           now.tv_sec == quitting_time.tv_sec && now.tv_usec >= quitting_time.tv_usec)
          break;
    
        if(m_jump_to_time && m_jump_to_time == m_tissue.time())
        {
          run(); // we've reached the time; this toggles (stops) the run.
          break;
        }
    
        if(m_tissue.run_to_time(m_tissue.time()+1) == false)
        {
          run();
          break;
        }
        else
        {
          m_history_view->sample();
          if(m_tissue.time() % m_redraw_frequency == 0 && m_jump_to_time == 0)
    	update();
        }
      }
    
      wxWakeUpIdle();
    //  cout << n << endl;
    }
    
    void Case::run()
    {
      if(!m_running)
      {
        std::cout << m_tissue << std::endl;
        m_run_button->SetLabel("Stop");
        m_running = true;
      }
      else
      {
        m_jump_to_time = 0;
        m_run_button->SetLabel("Run");
        m_running = false;
        std::cout << m_tissue.num_cells_created() << " cells have been created" << std::endl;
        update();
      }
    }
    
    void Case::update()
    {
    
      char buf[200];
      sprintf(buf, "Sim Time = %d", m_tissue.time());
      SetStatusText(buf);
    //  cout << buf << endl;
    
      m_3d_views->update();
      m_history_view->Refresh(FALSE);
    }
    
    void Case::OnRunButton(wxCommandEvent & event)
    {
      run();
    }
    
    void Case::OnSingleStepButton(wxCommandEvent & event)
    {
      m_jump_to_time = m_tissue.time()+1;
      run();
    }
    
    void Case::set_palette(const CancerSim::Palette & p)
    {
      m_3d_views->set_palette(p);
      m_history_view->set_palette(p);
    }
    
    void Case::clone(Case * c) const
    {
      m_tissue.clone(&c->m_tissue);
      m_history_view->clone(c->m_history_view);
      c->update();
    }
    
    void Case::OnDuplicateButton(wxCommandEvent &)
    {
      if(m_running)
        run(); // stop
      m_holder->case_holder_duplicate(this);
    }
    
    void Case::OnResetButton(wxCommandEvent &)
    {
      char buf[100];
      sprintf(buf, "%d", m_tissue.ni()*m_tissue.nj()*m_tissue.nk());
      wxTextEntryDialog dlg(this, "Max Number Of Cells", "Resize", buf);
      if(dlg.ShowModal()==wxID_OK)
      {
        int n = atoi(dlg.GetValue());
        if(n > 10)
        {
          Tissue_Parameters params = m_tissue.params();
          params.m_num_cell_locations = n;
          m_tissue.set_params(params);
          m_tissue.create(0, 0);
          m_history_view->discard();
          m_history_view->sample();
          update();
        }
      }
    }
    
    void Case::OnJumpTimeButton(wxCommandEvent &)
    { 
      char buf[100];
      sprintf(buf, "%d", m_tissue.time());
      wxTextEntryDialog dlg(this, "Jump To New Sim Time", "Jump Time", buf);
      if(dlg.ShowModal()==wxID_OK)
      {
        int n = atoi(dlg.GetValue());
        if(n < m_tissue.time())
        {
          m_tissue.create(0, 0);
          m_history_view->discard();
          m_history_view->sample();
          update();
        }
        m_jump_to_time = n;
        run();
      }
    }
    
    void Case::OnDualViewButton(wxCommandEvent &)
    {
      m_3d_views->toggle_split();
      m_dual_view_button->SetLabel(m_3d_views->is_split() ? "Single View" : "Dual View");
      Show();
    }
    
    void Case::OnScreenshotButton(wxCommandEvent &)
    {
      wxFileDialog dlg(this, "Save As .BMP In File...", "", "", "", wxSAVE|wxOVERWRITE_PROMPT);
      if(wxID_OK == dlg.ShowModal())
      {
        const char * error = m_3d_views->screenshot(dlg.GetPath());
        if(error)
          wxMessageDialog(this, error, "Error Saving Screenshot", wxOK).ShowModal();
      }
    }
    
    void Case::OnEditSettingsButton(wxCommandEvent &)
    {
      Tissue_Parameters_Dialog dlg(this, m_tissue.params());
      if(dlg.ShowModal())
        m_tissue.set_params(dlg.m_params);
    }
    
    void Case::OnEditRedrawFrequency(wxCommandEvent &)
    {
      char buf[100];
      sprintf(buf, "%d", m_redraw_frequency);
      wxTextEntryDialog dlg(this, "Redraw the display during a run every n timesteps:", "Redraw Frequency", buf);
      if(dlg.ShowModal()==wxID_OK)
        m_redraw_frequency = atoi(dlg.GetValue());
    }
    

    und schließlich Color_key.cc

    #include "Color_Key.h"
    
    #ifdef __WXMAC__
    #     include <GLUT/glut.h>
    #else
    #     include <GL/glut.h>
    #endif
    
    #include "Tissue.h"
    #include "gl_save_backbuffer_as_bmp.h"
    #include "gl_pixel_projection.h"
    #include "Caption.h"
    #include <algorithm>
    
    // count the number of bits set in an integer.
    static int count_bits(unsigned int n)
    {
    int result;
    for(result=0; n > 0; n>>=1)
    if(n&1)
    ++result;
    return result;
    }
    
    Color_Key::Color_Key(wxWindow * holder, const wxString& title, const wxPoint& pos) : 
    // the exact width doesn't matter since the boxes are scaled.
      wxFrame(holder,-1,title, pos, wxSize(600, Caption().height()*(Tissue::num_mutation_types()+2)*3/2)),
      m_canvas(0)
    {
      m_palette.resize(Tissue::num_genotypes());
    
      Color * begin = &m_palette[0];
      Color * end = &m_palette[Tissue::num_genotypes()-1];
      std::fill(begin, end, Color(0,0,0));
    
    // specify 'nice' colors for the most likely genotypes  - those with the smallest
    // number of mutations.  The rest are chosen pseudorandomly.
    
      m_palette[0] = Color(128,128,128); // no mutation
    
      unsigned char nice_colors[][3] = {
        { 120,120,120 },
        { 255,0,0 },
        { 0,255,0 },
        { 255,255,0 },
        { 0,0,255 },
        { 255,0,255 },
        { 0,255,255 },
        { 128,0,0 },
        { 200,200,200 },
        { 255,200,200 },
        { 200,255,200 },
        { 0,128,0 },
        { 200,200,255 },
        { 0,0,128 },
        { 128,0,128 },
        { 0,128,128 } };
    
      // determine the number of 'nice' colors to use.
    //  const int num_nice_colors = std::min(m_palette.size(), int(sizeof(nice_colors)/sizeof(nice_colors[0])));
      int num_nice_colors = int(sizeof(nice_colors)/sizeof(nice_colors[0]));
      if(m_palette.size() < num_nice_colors)
        num_nice_colors = m_palette.size();
    
      // assign the nice colors to the genotypes with the smallest number of mutations
      int num_nice_colors_used = 0;
      for(int num_bits = 0; num_nice_colors_used < num_nice_colors; ++num_bits)
      {
        for(int i=0; i < m_palette.size() && num_nice_colors_used < num_nice_colors; ++i)
          if(count_bits(i) == num_bits)
          {
    	m_palette[i] = Color(nice_colors[num_nice_colors_used][0], nice_colors[num_nice_colors_used][1], nice_colors[num_nice_colors_used][2]);
    	++num_nice_colors_used;
          }
      }
    
      // assign the rest of the palette arbitrarily
      Random_Number_Generator random(1974); // arbitrary seed.
      for(Color * cur = begin; cur != end; ++cur)
      {
        if(*cur == Color(0,0,0))
           *cur = Color(random(), random(), random());
      }
    
      m_canvas = new wxGLCanvas2(this, this);
    
      wxLayoutConstraints * c = new wxLayoutConstraints;
      c->left.SameAs(this, wxLeft);
      c->right.SameAs(this, wxRight);
      c->bottom.SameAs(this, wxBottom);
      c->top.SameAs(this, wxTop);
      m_canvas->SetConstraints(c);
      Layout();
      SetAutoLayout(true);
    }
    
    void Color_Key::render()
    {
      pixel_projection(false);
    
      glMatrixMode(GL_MODELVIEW);
      glPushMatrix();
    
      glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
      glClear(GL_COLOR_BUFFER_BIT);
      glDisable(GL_DEPTH_TEST);
      glColor3i(0,0,0);
    
      GLint viewport[4];
      glGetIntegerv(GL_VIEWPORT, viewport);
    
      const double outerSpacing = 4.0;
      const double innerSpacing = 2.0;
    
      // determine max width of any caption
      int maxTotalWidth=0;
      for(int iMut=0; iMut < Tissue::num_mutation_types(); ++iMut)
      {
        const int totalWidth = Caption(Tissue::mutation_name(Tissue::ith_mutation_type(iMut))).width();
        if(totalWidth > maxTotalWidth)
          maxTotalWidth = totalWidth;
      }
    
      double widthPerType = (viewport[2]-2*outerSpacing-Tissue::num_genotypes()*innerSpacing-maxTotalWidth)
        / Tissue::num_genotypes();
    
      // draw
      for(int iMut=-1; iMut < Tissue::num_mutation_types(); ++iMut)
      {
        glTranslated(0, Caption().height()+innerSpacing, 0);
        glPushMatrix();
        glTranslated(outerSpacing, 0.0, 0.0);
    
        if(iMut >= 0)
        {
          const Tissue::Mutation mut = Tissue::ith_mutation_type(iMut);
          const char * c = Tissue::mutation_name(mut);
          Caption(c).render(0,0,0);
        }
    
        glTranslated(maxTotalWidth+innerSpacing, 0, 0);
    
        for(int iType=0; iType < Tissue::num_genotypes(); ++iType)
        {
          if(iMut < 0)
    	glColor3ubv(&m_palette[iType].m_r);
    
          if(iMut < 0 || (1<<iMut)&iType)
          {
    	glBegin(GL_QUAD_STRIP);
    	glVertex2d(0, 0);
    	glVertex2d(0, -Caption().height());
    	glVertex2d(widthPerType, 0);
    	glVertex2d(widthPerType, -Caption().height());
    	glEnd();
          }
          glTranslated(widthPerType+innerSpacing, 0, 0);
        }
        glColor3ub(0,0,0);
        glPopMatrix();
      }
    
      glPopMatrix();
    }
    
    //  void Color_Key::keyboard_func(unsigned char key, int x, int y)
    //  {
    //    if(key == ' ')
    //    {
    //      // make sure an up-to-date rendering is in the backbuffer (lame)
    //      render();
    //      const char *filename = "screen.bmp";
    //      gl_save_backbuffer_as_bmp(filename);
    //    }
    //  }
    

    Wenn ihr noch was braucht, sagt Bescheid, ansonsten wäre ich über ein paar Antworten sehr froh!

    P.s.: Das Programm ist auch nicht von mir, d.h. sehr genaue Fragen dazu kann ich lieder nicht beantworten...



  • Du hast scheinbar vergessen eine benötigte Lib mitzulinken. Welche das ist siehst du an Hand der Ausgabe (ich erkenne jetzt nicht hundertprozentig woher die Klassen stammen könnten, aber ich tipp mal auf wxwidgets). Und wie du die dazulinkst entnimmst du am Besten der Doku deines Compilers/Linkers.



  • Danke erstmal für die schnelle Antwort!
    okay, ähm, ich kompiliere das Ganze über das Makefile auf der Kommandozeile, wie kann da denn jetzt die Doku sehen? Und wxWidgets ist richtig.



  • Die Doku deines Compilers findes du im Netz. Du musst vermutlich einfach nur das Makefile anpassen. Nach der Fehlermeldung zu googlen hilft auch häufig weiter - du bist vermutlich nicht der erste mit der Fehlermeldung 😉



  • Okay, ich hab die library hinzugefügt und die Fehlermeldungen sind weniger geworden. Jetzt gibt es nur noch Fehler bei den Programmen, die nichts mit wxWidgets zu tun haben:

    maggy:CancerSim praktikant$ make -f makefile2.txt
    g++ `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --libs --gl-libs` -lstdc++ -framework GLUT -framework OpenGL -framework Foundation   GUI.o   -o GUI
    Undefined symbols:
      "Case::create(int, char**)", referenced from:
          GUI::add_case()     in GUI.o
      "Case::Case(Case_Holder*, wxString const&, wxPoint const&, wxSize const&)", referenced from:
          GUI::add_case()     in GUI.o
      "Color_Key::Color_Key(wxWindow*, wxString const&, wxPoint const&)", referenced from:
          GUI::add_case()     in GUI.o
      "Case::set_palette(CancerSim::Palette const&)", referenced from:
          GUI::add_case()     in GUI.o
      "Case::clone(Case*) const", referenced from:
          GUI::case_holder_duplicate(Case const*) in GUI.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    

    Vorher konnte ich aber alle ganz normal kompilieren:

    maggy:CancerSim praktikant$ make -f makefile2.txt
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o GUI.o GUI.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Case.o Case.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o View_3d.o View_3d.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Tissue.o Tissue.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Trackball.o Trackball.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Zoom.o Zoom.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Connect_Adjacent_Points.o Connect_Adjacent_Points.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Grid_Vertex_Selection.o Grid_Vertex_Selection.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o gl_save_backbuffer_as_bmp.o gl_save_backbuffer_as_bmp.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Random_Number_Generator.o Random_Number_Generator.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Palette.o Palette.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Bit_Vector.o Bit_Vector.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Dual_3d_View.o Dual_3d_View.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o History_View.o History_View.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Tissue_Genotype_History.o Tissue_Genotype_History.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Color_Key.o Color_Key.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o gl_pixel_projection.o gl_pixel_projection.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Caption.o Caption.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o wxGLCanvas2.o wxGLCanvas2.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o gl_unproject.o gl_unproject.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Tissue_Parameters.o Tissue_Parameters.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Tissue_Parameters_Dialog.o Tissue_Parameters_Dialog.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Hash.o Hash.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Small_Sequence.o Small_Sequence.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Unlikely_Event.o Unlikely_Event.cc
    

    was hat das zu bedeuten?



  • Ja, Du compilierst alle Quelldateien, linkst dann aber nur die GUI.o zu einem Programm zusammen - da fehlen die ganzen Objekte.



  • ok, ich schätze mal du meintest, das es so aussehen sollte(natürlich ohne den Fehler):

    maggy:CancerSim praktikant$ make -f makefile2.txt
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o GUI.o GUI.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Case.o Case.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o View_3d.o View_3d.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Tissue.o Tissue.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Trackball.o Trackball.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Zoom.o Zoom.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Connect_Adjacent_Points.o Connect_Adjacent_Points.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Grid_Vertex_Selection.o Grid_Vertex_Selection.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Multi_Grid_View.o Multi_Grid_View.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o gl_save_backbuffer_as_bmp.o gl_save_backbuffer_as_bmp.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Random_Number_Generator.o Random_Number_Generator.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Palette.o Palette.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Bit_Vector.o Bit_Vector.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Dual_3d_View.o Dual_3d_View.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o History_View.o History_View.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Tissue_Genotype_History.o Tissue_Genotype_History.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Color_Key.o Color_Key.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o gl_pixel_projection.o gl_pixel_projection.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Caption.o Caption.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o wxGLCanvas2.o wxGLCanvas2.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o gl_unproject.o gl_unproject.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Tissue_Parameters.o Tissue_Parameters.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Tissue_Parameters_Dialog.o Tissue_Parameters_Dialog.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Hash.o Hash.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Small_Sequence.o Small_Sequence.cc
    g++  -c -O3  `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --cxxflags`  -c -o Unlikely_Event.o Unlikely_Event.cc
    g++ -o GUI GUI.o Case.o View_3d.o Tissue.o Trackball.o Zoom.o Connect_Adjacent_Points.o Grid_Vertex_Selection.o Multi_Grid_View.o gl_save_backbuffer_as_bmp.o Random_Number_Generator.o Palette.o Bit_Vector.o Dual_3d_View.o History_View.o Tissue_Genotype_History.o Color_Key.o gl_pixel_projection.o Caption.o wxGLCanvas2.o gl_unproject.o Tissue_Parameters.o Tissue_Parameters_Dialog.o Hash.o Small_Sequence.o Unlikely_Event.o `/Users/praktikant/Desktop/wxMac-2.8.10/build-ansi/wx-config --libs --gl-libs` -lstdc++ -framework GLUT -framework OpenGL -framework Foundation  #GUI
    Undefined symbols:
      "wxGLCanvas::MacSuperShown(bool)", referenced from:
          vtable for wxGLCanvas2in wxGLCanvas2.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make: *** [GUI] Error 1
    

    Das doofe ist jetzt, dass er Probleme mit wxGLCanvas hat. Das gehört aber auch zu wxWidgets und da hab ich ja eigentlich die libraries...

    hier nochmal wxGLCanvas2.cc falls das irgendwie hilft...

    #include "wxGLCanvas2.h"
    
    BEGIN_EVENT_TABLE(wxGLCanvas2, wxGLCanvas)
      EVT_PAINT(wxGLCanvas2::OnPaint)
      //EVT_ERASE_BACKGROUND(wxGLCanvas2::OnEraseBackground)
    END_EVENT_TABLE()
    
    wxGLCanvas2::wxGLCanvas2(wxWindow * parent, wxGLCanvas2_Render * render)
      : wxGLCanvas(parent,-1), m_render(render)
    {
    
    }
    
    void wxGLCanvas2::OnPaint(wxPaintEvent & e)
    {
      wxPaintDC dc(this);
    //  cout << "wxGLCanvas2::OnPaint" << endl;
      SetCurrent();
      m_render->render();
      SwapBuffers();
    }
    

    Sorry, dass ich mich schwierig anstelle...



  • http://wiki.wxwidgets.org/Wx-Config
    Bidde 🙂
    `wx-config --libs` <- das suchst du
    lg



  • okay hab jetzt alles was ich brauche, vielen Dank!!!


Anmelden zum Antworten