crossplatform.ru

Здравствуйте, гость ( Вход | Регистрация )


  Ответ в undefined reference to, codebloks
Введите ваше имя
Подтвердите код

Введите в поле код из 6 символов, отображенных в виде изображения. Если вы не можете прочитать код с изображения, нажмите на изображение для генерации нового кода.
 

Опции сообщения
 Включить смайлы?
Иконки сообщения
(Опционально)
                                
                                
  [ Без иконки ]
 


Последние 10 сообщений [ в обратном порядке ]
Iron Bug Дата 9.6.2014, 8:23
 

ОФФ:

модератору: тему переименовать, ибо тут ничего нет ни про undefined reference, ни, тем более, про codeblocks.
OKTA Дата 9.6.2014, 0:27
  Это не ошибки, а ворнинги. После компиляции не запускается?
OLEGVT Дата 7.6.2014, 17:32
  Всем привет! У меня при построении проекта выдает вот такие ошибки:

C:\uir\pr\cb\test6\test6Main.cpp||In constructor 'TestGLCanvas::TestGLCanvas(wxWindow*, wxWindowID, const wxPoint&, const wxSize&, long int, const wxString&)':|
C:\uir\pr\cb\test6\test6Main.cpp|79|warning: 'wxGLCanvas::wxGLCanvas(wxWindow*, const wxGLCanvas*, wxWindowID, const wxPoint&, const wxSize&, long int, const wxString&, const int*, const wxPalette&)' is deprecated (declared at C:\wxWidgets-3.0.0\include/wx/msw/glcanvas.h:119) [-Wdeprecated-declarations]|
C:\uir\pr\cb\test6\test6Main.cpp||In constructor 'TestGLCanvas::TestGLCanvas(wxWindow*, const TestGLCanvas*, wxWindowID, const wxPoint&, const wxSize&, long int, const wxString&)':|
C:\uir\pr\cb\test6\test6Main.cpp|86|warning: 'wxGLContext* wxGLCanvasBase::GetContext() const' is deprecated (declared at C:\wxWidgets-3.0.0\include/wx/glcanvas.h:136) [-Wdeprecated-declarations]|
C:\uir\pr\cb\test6\test6Main.cpp|86|warning: 'wxGLCanvas::wxGLCanvas(wxWindow*, const wxGLContext*, wxWindowID, const wxPoint&, const wxSize&, long int, const wxString&, const int*, const wxPalette&)' is deprecated (declared at C:\wxWidgets-3.0.0\include/wx/msw/glcanvas.h:107) [-Wdeprecated-declarations]|
C:\uir\pr\cb\test6\test6Main.cpp||In member function 'void TestGLCanvas::Render()':|
C:\uir\pr\cb\test6\test6Main.cpp|101|warning: 'wxGLContext* wxGLCanvasBase::GetContext() const' is deprecated (declared at C:\wxWidgets-3.0.0\include/wx/glcanvas.h:136) [-Wdeprecated-declarations]|
C:\uir\pr\cb\test6\test6Main.cpp|104|warning: 'void wxGLCanvasBase::SetCurrent()' is deprecated (declared at C:\wxWidgets-3.0.0\include/wx/glcanvas.h:138) [-Wdeprecated-declarations]|
C:\uir\pr\cb\test6\test6Main.cpp||In member function 'void TestGLCanvas::InitGL()':|
C:\uir\pr\cb\test6\test6Main.cpp|179|warning: 'void wxGLCanvasBase::SetCurrent()' is deprecated (declared at C:\wxWidgets-3.0.0\include/wx/glcanvas.h:138) [-Wdeprecated-declarations]|
||=== Build finished: 0 error(s), 6 warning(s) (0 minute(s), 49 second(s)) ===|

test6Main.cpp

#include "wx/wxprec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

#if !wxUSE_GLCANVAS
#error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
#endif

#include "test6Main.h"
//#include "sample.xpm"

#ifndef __WXMSW__     // for StopWatch, see remark below
#if defined(__WXMAC__) && !defined(__DARWIN__)
#include <utime.h>
#include <unistd.h>
#else
#include <sys/time.h>
#include <sys/unistd.h>
#endif
#else
#include <sys/timeb.h>
#endif

/*----------------------------------------------------------------------
Utility function to get the elapsed time (in msec) since a given point
in time (in sec)  (because current version of wxGetElapsedTime doesnґt
works right with glibc-2.1 and linux, at least for me)
-----------------------------------------------------------------------*/
unsigned long StopWatch( unsigned long *sec_base )
{
  unsigned long secs,msec;

  #if defined(__WXMSW__)
  struct timeb tb;
  ftime( &tb );
  secs = tb.time;
  msec = tb.millitm;
  #elif defined(__WXMAC__) && !defined(__DARWIN__)
  wxLongLong tl = wxGetLocalTimeMillis();
  secs = (unsigned long) (tl.GetValue() / 1000);
  msec = (unsigned long) (tl.GetValue() - secs*1000);
  #else
  // think every unice has gettimeofday
  struct timeval tv;
  gettimeofday( &tv, (struct timezone *)NULL );
  secs = tv.tv_sec;
  msec = tv.tv_usec/1000;
  #endif

  if( *sec_base == 0 )
  *sec_base = secs;

  return( (secs-*sec_base)*1000 + msec );
}

/*----------------------------------------------------------------
Implementation of Test-GLCanvas
-----------------------------------------------------------------*/

BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas)
  EVT_SIZE(TestGLCanvas::OnSize)
  EVT_PAINT(TestGLCanvas::OnPaint)
  EVT_ERASE_BACKGROUND(TestGLCanvas::OnEraseBackground)
  EVT_ENTER_WINDOW( TestGLCanvas::OnEnterWindow )
END_EVENT_TABLE()

unsigned long  TestGLCanvas::m_secbase = 0;
int            TestGLCanvas::m_TimeInitialized = 0;
unsigned long  TestGLCanvas::m_xsynct;
unsigned long  TestGLCanvas::m_gsynct;

TestGLCanvas::TestGLCanvas(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
                          : wxGLCanvas(parent, (wxGLCanvas*) NULL, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE , name )
{
  m_init = false;
  m_gllist = 0;
}

TestGLCanvas::TestGLCanvas(wxWindow *parent, const TestGLCanvas *other, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
                          : wxGLCanvas(parent, other->GetContext(), id, pos, size, style|wxFULL_REPAINT_ON_RESIZE , name)
{
  m_init = false;
  m_gllist = other->m_gllist; // share display list
}

TestGLCanvas::~TestGLCanvas()
{
}

void TestGLCanvas::Render()
{
  wxPaintDC dc(this);

  #ifndef __WXMOTIF__
  if (!GetContext()) return;
  #endif

  SetCurrent();
  // Init OpenGL once, but after SetCurrent
  if (!m_init)
  {
    InitGL();
    m_init = true;
  }

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glFrustum(-0.5f, 0.5f, -0.5f, 0.5f, 1.0f, 3.0f);
  glMatrixMode(GL_MODELVIEW);

  /* clear color and depth buffers */
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  if( m_gllist == 0 )
  {
    m_gllist = glGenLists( 1 );
    glNewList( m_gllist, GL_COMPILE_AND_EXECUTE );
    /* draw six faces of a cube */
    glBegin(GL_QUADS);
    glNormal3f( 0.0f, 0.0f, 1.0f);
    glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f(-0.5f, 0.5f, 0.5f);
    glVertex3f(-0.5f,-0.5f, 0.5f); glVertex3f( 0.5f,-0.5f, 0.5f);

    glNormal3f( 0.0f, 0.0f,-1.0f);
    glVertex3f(-0.5f,-0.5f,-0.5f); glVertex3f(-0.5f, 0.5f,-0.5f);
    glVertex3f( 0.5f, 0.5f,-0.5f); glVertex3f( 0.5f,-0.5f,-0.5f);

    glNormal3f( 0.0f, 1.0f, 0.0f);
    glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f( 0.5f, 0.5f,-0.5f);
    glVertex3f(-0.5f, 0.5f,-0.5f); glVertex3f(-0.5f, 0.5f, 0.5f);

    glNormal3f( 0.0f,-1.0f, 0.0f);
    glVertex3f(-0.5f,-0.5f,-0.5f); glVertex3f( 0.5f,-0.5f,-0.5f);
    glVertex3f( 0.5f,-0.5f, 0.5f); glVertex3f(-0.5f,-0.5f, 0.5f);

    glNormal3f( 1.0f, 0.0f, 0.0f);
    glVertex3f( 0.5f, 0.5f, 0.5f); glVertex3f( 0.5f,-0.5f, 0.5f);
    glVertex3f( 0.5f,-0.5f,-0.5f); glVertex3f( 0.5f, 0.5f,-0.5f);

    glNormal3f(-1.0f, 0.0f, 0.0f);
    glVertex3f(-0.5f,-0.5f,-0.5f); glVertex3f(-0.5f,-0.5f, 0.5f);
    glVertex3f(-0.5f, 0.5f, 0.5f); glVertex3f(-0.5f, 0.5f,-0.5f);
    glEnd();

    glEndList();
  }
  else
  {
    glCallList(m_gllist);
  }

  glFlush();
  SwapBuffers();
}

void TestGLCanvas::OnEnterWindow( wxMouseEvent& WXUNUSED(event) )
{
  SetFocus();
}

void TestGLCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
  Render();
}

void TestGLCanvas::OnEraseBackground(wxEraseEvent& WXUNUSED(event))
{
  // Do nothing, to avoid flashing.
}

void TestGLCanvas::InitGL()
{
  SetCurrent();

  /* set viewing projection */
  glMatrixMode(GL_PROJECTION);
  glFrustum(-0.5f, 0.5f, -0.5f, 0.5f, 1.0f, 3.0f);

  /* position viewer */
  glMatrixMode(GL_MODELVIEW);
  glTranslatef(0.0f, 0.0f, -2.0f);

  /* position object */
  glRotatef(30.0f, 1.0f, 0.0f, 0.0f);
  glRotatef(30.0f, 0.0f, 1.0f, 0.0f);

  glEnable(GL_DEPTH_TEST);
  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
}

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
  EVT_MENU(wxID_EXIT, MyFrame::OnExit)
END_EVENT_TABLE()

// My frame constructor
MyFrame::MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
        : wxFrame(parent, wxID_ANY, title, pos, size, style)
{
  m_canvas = NULL;
//  SetIcon(wxIcon(sample_xpm));
}

// Intercept menu commands
void MyFrame::OnExit( wxCommandEvent& WXUNUSED(event) )
{
  // true is to force the frame to close
  Close(true);
}

/*static*/ MyFrame *MyFrame::Create(MyFrame *parentFrame, bool isCloneWindow)
{
  wxString str = wxT("wxWidgets OpenGL Cube Sample");
  if (isCloneWindow) str += wxT(" - Clone");

  MyFrame *frame = new MyFrame(NULL, str, wxDefaultPosition,
  wxSize(400, 300));

  // Make a menubar
  wxMenu *winMenu = new wxMenu;

  winMenu->Append(wxID_EXIT, _T("&Close"));
  wxMenuBar *menuBar = new wxMenuBar;
  menuBar->Append(winMenu, _T("&Window"));

  frame->SetMenuBar(menuBar);

  if (parentFrame)
  {
    frame->m_canvas = new TestGLCanvas( frame, parentFrame->m_canvas,
    wxID_ANY, wxDefaultPosition, wxDefaultSize );
  }
  else
  {
    frame->m_canvas = new TestGLCanvas(frame, wxID_ANY,
    wxDefaultPosition, wxDefaultSize);
  }

  // Show the frame
  frame->Show(true);

  return frame;
}

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
  MyFrame::Create(NULL);

  return true;
}


test6Main.h

#ifndef _WX_CUBE_H_
#define _WX_CUBE_H_

#include "wx/glcanvas.h"

// Define a new application type
class MyApp: public wxApp
{
public:
  bool OnInit();
};

// Define a new frame type
class TestGLCanvas;

class MyFrame: public wxFrame
{
public:
  static MyFrame *Create(MyFrame *parentFrame, bool isCloneWindow = false);
  void OnExit(wxCommandEvent& event);

private:
  MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos,
  const wxSize& size, long style = wxDEFAULT_FRAME_STYLE);

  TestGLCanvas *m_canvas;

  DECLARE_EVENT_TABLE()
};

#if wxUSE_GLCANVAS

class TestGLCanvas: public wxGLCanvas
{
  friend class MyFrame;
public:
  TestGLCanvas( wxWindow *parent, wxWindowID id = wxID_ANY,
  const wxPoint& pos = wxDefaultPosition,
  const wxSize& size = wxDefaultSize,
  long style = 0, const wxString& name = _T("TestGLCanvas") );

  TestGLCanvas( wxWindow *parent, const TestGLCanvas *other,
  wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
  const wxSize& size = wxDefaultSize, long style = 0,
  const wxString& name = _T("TestGLCanvas") );

  ~TestGLCanvas();

  void OnPaint(wxPaintEvent& event);
  void OnEraseBackground(wxEraseEvent& event);
  void OnEnterWindow(wxMouseEvent& event);

  void Render();
  void InitGL();

private:
  bool   m_init;
  GLuint m_gllist;

  static unsigned long  m_secbase;
  static int            m_TimeInitialized;
  static unsigned long  m_xsynct;
  static unsigned long  m_gsynct;

  unsigned long  m_StartTime;
  unsigned long  m_LastTime;
  unsigned long  m_LastRedraw;

  DECLARE_EVENT_TABLE()
};

#endif // #if wxUSE_GLCANVAS

#endif // #ifndef _WX_CUBE_H_


Если я правильно понимаю, то не хватает каких-то библиотек. Если это так, то каких и как их подключать?
Просмотр темы полностью (откроется в новом окне)
RSS Текстовая версия Сейчас: 29.3.2024, 0:45