iDevGames Forums
wxWidgets/OpenGL/C++ and GCC... Help! - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: wxWidgets/OpenGL/C++ and GCC... Help! (/thread-915.html)



wxWidgets/OpenGL/C++ and GCC... Help! - TimMcD - Aug 3, 2009 02:59 PM

Hey, I'd like to help a friend of mine on a project of his. He is using wxWidgets and OpenGL. (He is on Windows, I'd also manage the Mac port) However, I usually use different scripting language (Lua, Ruby, Python, etc.). Can anyone help me figure out how to setup a basic project using wxWidgets and OpenGL? The whole GCC and Linking thing is confusing me, and I'd like to be able to just set this up first.

On a side note, whenever I make XCode projects and add OpenGL/GLUT/any other framework and try to build, I always get errors along the line of 'unrecognized symbol _main' or somesuch.

Any and all help is appreciated!


wxWidgets/OpenGL/C++ and GCC... Help! - wyrmmage - Aug 3, 2009 07:11 PM

TimMcD Wrote:The whole GCC and Linking thing is confusing me, and I'd like to be able to just set this up first.

That's pretty vague; you're probably going to have to provide some more details in order for someone to be able to help you.

From what I remember of my experience with wxWidgets at work, they had *mediocre* documentation; have you had a look at it?


wxWidgets/OpenGL/C++ and GCC... Help! - TimMcD - Aug 5, 2009 03:00 PM

Well, currently I have this:
Code:
// HelloWorldApp.h
#ifndef INCLUDED_HELLOWORLDAPP_H
#define INCLUDED_HELLOWORLDAPP_H

class HelloWorldApp : public wxApp {
public:
  virtual bool OnInit();
};

DECLARE_APP(HelloWorldApp)
#endif // INCLUDED_HELLOWORLDAPP_H

and

Code:
// HelloWorldApp.cpp
#include "wx/wxprec.h"

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

#include "HelloWorldApp.h"

IMPLEMENT_APP(HelloWorldApp);

bool HelloWorldApp::OnInit()
{
  wxFrame *frame = new wxFrame((wxFrame*)NULL, -1, _T("Hello wxWidgets World"));
  frame->CreateStatusBar();
  frame->SetStatusText(_T("Hello, World!"));
  SetTopWindow(frame);
  return true;
}

I compile with
Code:
gcc HelloWorldApp.cpp -I/opt/local/lib/wx/include/mac-unicode-release-2.8 -I/opt/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__

And I get this error:
Code:
Undefined symbols:
  "wxObject::CreateRefData() const", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "operator new(unsigned long)", referenced from:
      wxCreateApp()     in ccy4zD51.o
      HelloWorldApp::OnInit()      in ccy4zD51.o
  "___gxx_personality_v0", referenced from:
      ___gxx_personality_v0$non_lazy_ptr in ccy4zD51.o
  "wxApp::WakeUpIdle()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "_wxFrameNameStr", referenced from:
      _wxFrameNameStr$non_lazy_ptr in ccy4zD51.o
  "typeinfo for wxApp", referenced from:
      typeinfo for HelloWorldAppin ccy4zD51.o
  "wxApp::MacReopenApp()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxFrameBase::wxFrameBase()", referenced from:
      wxFrame::wxFrame(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&)in ccy4zD51.o
  "wxThread::~wxThread()", referenced from:
      wxThreadHelperThread::~wxThreadHelperThread()in ccy4zD51.o
      wxThreadHelperThread::~wxThreadHelperThread()in ccy4zD51.o
  "_wxDefaultSize", referenced from:
      _wxDefaultSize$non_lazy_ptr in ccy4zD51.o
  "wxEvtHandler::SearchEventTable(wxEventTable&, wxEvent&)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "vtable for __cxxabiv1::__class_type_info", referenced from:
      typeinfo for wxTransform2Din ccy4zD51.o
  "wxAppBase::OnExceptionInMainLoop()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppBase::Exit()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxFrame::Create(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&)", referenced from:
      wxFrame::wxFrame(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&)in ccy4zD51.o
  "wxRect2DInt::operator=(wxRect2DInt const&)", referenced from:
      wxTransform2D::Transform(wxRect2DInt*) const  in ccy4zD51.o
      wxTransform2D::InverseTransform(wxRect2DInt*) const   in ccy4zD51.o
  "operator delete(void*)", referenced from:
      wxCreateApp()     in ccy4zD51.o
      HelloWorldApp::OnInit()      in ccy4zD51.o
      wxApp::~wxApp()in ccy4zD51.o
      wxTransform2D::~wxTransform2D()in ccy4zD51.o
      wxTransform2D::~wxTransform2D()in ccy4zD51.o
      HelloWorldApp::~HelloWorldApp()in ccy4zD51.o
      HelloWorldApp::~HelloWorldApp()in ccy4zD51.o
      wxThreadHelperThread::~wxThreadHelperThread()in ccy4zD51.o
      wxThreadHelperThread::~wxThreadHelperThread()in ccy4zD51.o
  "wxAppConsole::CheckBuildOptions(char const*, char const*)", referenced from:
      wxCreateApp()     in ccy4zD51.o
  "wxApp::OnInitGui()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppConsole::OnCmdLineHelp(wxCmdLineParser&)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::GetEventHashTable() const", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppConsole::OnCmdLineError(wxCmdLineParser&)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "_wxDefaultPosition", referenced from:
      _wxDefaultPosition$non_lazy_ptr in ccy4zD51.o
  "wxThread::TestDestroy()", referenced from:
      vtable for wxThreadHelperThreadin ccy4zD51.o
  "wxEvtHandler::DoSetClientObject(wxClientData*)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::MacHandleAERApp(void*, void*)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::MacHandleAEPDoc(void*, void*)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::MacNewFile()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::MacPrintFile(wxString const&)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "typeinfo for wxThread", referenced from:
      typeinfo for wxThreadHelperThreadin ccy4zD51.o
  "wxEvtHandler::DoSetClientData(void*)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppBase::OnCmdLineParsed(wxCmdLineParser&)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::MacOpenFile(wxString const&)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppBase::GetDisplayMode() const", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppBase::Pending()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxEvtHandler::ProcessEvent(wxEvent&)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::CleanUp()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppBase::Dispatch()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::MacHandleAEODoc(void*, void*)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "_wxStatusLineNameStr", referenced from:
      _wxStatusLineNameStr$non_lazy_ptr in ccy4zD51.o
  "wxAppConsole::ms_appInitFn", referenced from:
      __ZN12wxAppConsole12ms_appInitFnE$non_lazy_ptr in ccy4zD51.o
  "vtable for __cxxabiv1::__si_class_type_info", referenced from:
      typeinfo for wxThreadHelperThreadin ccy4zD51.o
      typeinfo for HelloWorldAppin ccy4zD51.o
  "wxApp::MacHandleUnhandledEvent(void*)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "___cxa_pure_virtual", referenced from:
      vtable for wxTransform2Din ccy4zD51.o
      vtable for wxTransform2Din ccy4zD51.o
  "wxEvtHandler::DoGetClientObject() const", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppConsole::ms_appInstance", referenced from:
      __ZN12wxAppConsole14ms_appInstanceE$non_lazy_ptr in ccy4zD51.o
  "wxAppBase::CreateTraits()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "vtable for wxApp", referenced from:
      __ZTV5wxApp$non_lazy_ptr in ccy4zD51.o
  "wxAppBase::ProcessIdle()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppBase::~wxAppBase()", referenced from:
      wxApp::~wxApp()in ccy4zD51.o
  "vtable for wxFrame", referenced from:
      __ZTV7wxFrame$non_lazy_ptr in ccy4zD51.o
  "wxEvtHandler::DoGetClientData() const", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxFrame::Init()", referenced from:
      wxFrame::wxFrame(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&)in ccy4zD51.o
  "wxAppConsole::FilterEvent(wxEvent&)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppBase::OnExit()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppBase::SetActive(bool, wxWindow*)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppBase::ExitMainLoop()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::wxApp()", referenced from:
      HelloWorldApp::HelloWorldApp()in ccy4zD51.o
  "wxFrameBase::~wxFrameBase()", referenced from:
      wxFrame::wxFrame(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&)in ccy4zD51.o
  "wxAppBase::OnInitCmdLine(wxCmdLineParser&)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::GetEventTable() const", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::MacHandleAEOApp(void*, void*)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxStringBase::npos", referenced from:
      __ZN12wxStringBase4nposE$non_lazy_ptr in ccy4zD51.o
  "wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppBase::MainLoop()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::MacHandleAEQuit(void*, void*)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::GetClassInfo() const", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppBase::GetLayoutDirection() const", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxEvtHandler::TryParent(wxEvent&)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppBase::GetTopWindow() const", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxApp::Initialize(int&, wchar_t**)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxStringBase::InitWith(wchar_t const*, unsigned long, unsigned long)", referenced from:
      wxStringBase::wxStringBase(wchar_t const*)in ccy4zD51.o
  "wxApp::Yield(bool)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxEntry(int&, char**)", referenced from:
      _main in ccy4zD51.o
  "wxAppBase::OnRun()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxObject::CloneRefData(wxObjectRefData const*) const", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&)", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
  "wxAppConsole::ProcessPendingEvents()", referenced from:
      vtable for HelloWorldAppin ccy4zD51.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

That's the main issue in the way right now. I'll try to get OpenGL working with it later, right now I have to get wxW working xD


wxWidgets/OpenGL/C++ and GCC... Help! - TomorrowPlusX - Aug 10, 2009 01:50 PM

Looks like you're not linking against wx's libraries. You may be better off using xcode instead of building by hand on the command line. You'd just add wx's include dir and add whatever wx's libs are to the target.