Author Topic: wx/sizer.h  (Read 5215 times)

gwbcomm

  • Guest
wx/sizer.h
« on: January 26, 2011, 02:08:00 am »
using Ubuntu 10.4 -  code::blocks 8.02 wxsmith2.8.10

I can create, compile and run wxsmith apps, stand alone.
I can create, compile and run opengl apps, stand alone.

When I try to add a wxsmith gui to my opengl app I get the following errors:

my opengl code is below the errors.


/home/gary/Documents/gluta/NewFrame.h|5|error: wx/sizer.h: No such file or directory|
/home/gary/Documents/gluta/NewFrame.h|6|error: wx/panel.h: No such file or directory|
/home/gary/Documents/gluta/NewFrame.h|7|error: wx/button.h: No such file or directory|
/home/gary/Documents/gluta/NewFrame.h|8|error: wx/frame.h: No such file or directory|
/home/gary/Documents/gluta/NewFrame.cpp|4|error: wx/intl.h: No such file or directory|
/home/gary/Documents/gluta/NewFrame.cpp|5|error: wx/string.h: No such file or directory|
/home/gary/Documents/gluta/NewFrame.h|12|error: expected class-name before ‘{’ token|
/home/gary/Documents/gluta/NewFrame.h|15|error: expected ‘)’ before ‘*’ token|
/home/gary/Documents/gluta/NewFrame.h|19|error: ISO C++ forbids declaration of ‘wxButton’ with no type|
/home/gary/Documents/gluta/NewFrame.h|19|error: expected ‘;’ before ‘*’ token|
/home/gary/Documents/gluta/NewFrame.h|20|error: ISO C++ forbids declaration of ‘wxPanel’ with no type|
/home/gary/Documents/gluta/NewFrame.h|20|error: expected ‘;’ before ‘*’ token|
/home/gary/Documents/gluta/NewFrame.h|33|error: ‘wxCommandEvent’ has not been declared|
/home/gary/Documents/gluta/NewFrame.h|36|error: ISO C++ forbids declaration of ‘DECLARE_EVENT_TABLE’ with no type|
/home/gary/Documents/gluta/NewFrame.h|37|error: expected ‘;’ before ‘}’ token|
/home/gary/Documents/gluta/NewFrame.h|37|error: expected ‘;’ before ‘}’ token|
/home/gary/Documents/gluta/NewFrame.cpp|9|error: ‘wxNewId’ was not declared in this scope|
/home/gary/Documents/gluta/NewFrame.cpp|10|error: ‘wxNewId’ was not declared in this scope|
/home/gary/Documents/gluta/NewFrame.cpp|13|error: ‘wxFrame’ has not been declared|
/home/gary/Documents/gluta/NewFrame.cpp|16|error: expected constructor, destructor, or type conversion before ‘END_EVENT_TABLE’|
/home/gary/Documents/gluta/NewFrame.cpp|45|error: variable or field ‘OnButton1Click’ declared void|
/home/gary/Documents/gluta/NewFrame.cpp|45|error: ‘wxCommandEvent’ was not declared in this scope|
/home/gary/Documents/gluta/NewFrame.cpp|45|error: ‘event’ was not declared in this scope|
||=== Build finished: 23 errors, 0 warnings ===|


//------------main.cpp-------------------
#include <stdio.h>
#include <stdlib.h>

#include <GL/glx.h>    /* this includes the necessary X headers */
#include <GL/gl.h>
#include <GL/glut.h>
#include <X11/X.h>    /* X11 constant (e.g. TrueColor) */
#include <X11/keysym.h>
void display(void)
{
/*  clear all pixels  */
    glClear (GL_COLOR_BUFFER_BIT);

/*  draw white polygon (rectangle) with corners at
 *  (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)
 */
    glColor3f (1.0, 1.0, 1.0);
    glBegin(GL_POLYGON);
        glVertex3f (0.25, 0.25, 0.0);
        glVertex3f (0.75, 0.25, 0.0);
        glVertex3f (0.75, 0.75, 0.0);
        glVertex3f (0.25, 0.75, 0.0);
    glEnd();

/*  don't wait!
 *  start processing buffered OpenGL routines
 */
    glFlush ();
}

void init (void)
{
/*  select clearing (background) color       */
    glClearColor (0.0, 0.0, 0.0, 0.0);

/*  initialize viewing values  */
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}

/*
 *  Declare initial window size, position, and display mode
 *  (single buffer and RGBA).  Open window with "hello"
 *  in its title bar.  Call initialization routines.
 *  Register callback function to display graphics.
 *  Enter main loop and process events.
 */
int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize (250, 250);
    glutInitWindowPosition (100, 100);
    glutCreateWindow ("hello");
    init ();
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;   /* ISO C requires main to return int. */
}

//------------end main.cpp-------------------


//-----------NewFrame.h---------------------

#ifndef NEWFRAME_H
#define NEWFRAME_H

//(*Headers(NewFrame)
#include <wx/sizer.h>
#include <wx/panel.h>
#include <wx/button.h>
#include <wx/frame.h>
//*)

class NewFrame: public wxFrame
{
   public:

      NewFrame(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize);
      virtual ~NewFrame();

      //(*Declarations(NewFrame)
      wxButton* Button1;
      wxPanel* Panel1;
      //*)

   protected:

      //(*Identifiers(NewFrame)
      static const long ID_BUTTON1;
      static const long ID_PANEL1;
      //*)

   private:

      //(*Handlers(NewFrame)
      void OnButton1Click(wxCommandEvent& event);
      //*)

      DECLARE_EVENT_TABLE()
};

#endif

//----------- end NewFrame.h---------------------

//-----------NewFrame.cpp---------------------

#include "NewFrame.h"

//(*InternalHeaders(NewFrame)
#include <wx/intl.h>
#include <wx/string.h>
//*)

//(*IdInit(NewFrame)
const long NewFrame::ID_BUTTON1 = wxNewId();
const long NewFrame::ID_PANEL1 = wxNewId();
//*)

BEGIN_EVENT_TABLE(NewFrame,wxFrame)
   //(*EventTable(NewFrame)
   //*)
END_EVENT_TABLE()

NewFrame::NewFrame(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
   //(*Initialize(NewFrame)
   wxBoxSizer* BoxSizer1;

   Create(par//-----------NewFrame.h---------------------ent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
   SetClientSize(wxDefaultSize);
   Move(wxDefaultPosition);
   BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
   Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
   Button1 = new wxButton(Panel1, ID_BUTTON1, _("Label"), wxPoint(8,8), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
   BoxSizer1->Add(Panel1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
   SetSizer(BoxSizer1);
   BoxSizer1->Fit(this);
   BoxSizer1->SetSizeHints(this);

   Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&NewFrame::OnButton1Click);
   //*)
}

NewFrame::~NewFrame()
{
   //(*Destroy(NewFrame)
   //*)
}


void NewFrame::OnButton1Click(wxCommandEvent& event)
{
}

//-----------end NewFrame.cpp---------------------

When I search sizer.h is found but wx/sizer.h is not.

Any help is appreciated


Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: wx/sizer.h
« Reply #1 on: January 26, 2011, 05:24:47 am »
First:
wxSmith is a gui-builder for wxWidgets, not wxWidgets itself.
Second:
it looks like you try to compile C++-code with a C-compiler.
C::B uses the fileextension to decide, whether the C- or the C++-compiler should be used.
If you use wxWidgets, make sure your file-extension is cpp (or cxx or cc) but not c or C.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: wx/sizer.h
« Reply #2 on: January 26, 2011, 06:53:11 am »
Also read this: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Probably you're missing the `wx-config --cflags` and `wx-config --libs` in the settings.

And please next time use code tags, so your post is a bit more readable.
Also you could update C::B to 10.05 :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]