User forums > Using Code::Blocks

wxFormBuilder generated classes and using them within code::blocks

(1/2) > >>

blue orb:
i can't get the files generated by wxFormBuilder to work. when i add these wfb-generated .cpp and .h files to the active project, in code::blocks, i get more errors. do i need resource files? what are rs files?

btw, wxWidgets projects compile/run fine and all is ok there. so that's something!

however, wxsmith content still won't compile and is giving error messages about missing headers.

i have now tried three seperate compilers (minGW 32-bit, minGW 64-bit and that dw2 gcc compiler.

i am a noob, yet this just gets more and more complicated... ;)

stahta01:
Error messages have meaning; I suggest reading them.
You might even post them.

Your problem is likely an Compiler/Linker problem instead of a Code::Blocks problem; without the errors, I can only guess it is user caused problem.

Tim S.

blue orb:
here's the error messages and the code

the compiler errors
----------------------


--- Code: ---||=== pluto, Debug ===|
I:\My Documents\CodeBlocks C++\pluto\zero.h|11|error: wx/artprov.h: No such file or directory|
I:\My Documents\CodeBlocks C++\pluto\zero.h|12|error: wx/xrc/xmlres.h: No such file or directory|
I:\My Documents\CodeBlocks C++\pluto\zero.h|13|error: wx/string.h: No such file or directory|
I:\My Documents\CodeBlocks C++\pluto\zero.h|14|error: wx/frame.h: No such file or directory|
I:\My Documents\CodeBlocks C++\pluto\zero.h|15|error: wx/gdicmn.h: No such file or directory|
I:\My Documents\CodeBlocks C++\pluto\zero.h|16|error: wx/font.h: No such file or directory|
I:\My Documents\CodeBlocks C++\pluto\zero.h|17|error: wx/colour.h: No such file or directory|
I:\My Documents\CodeBlocks C++\pluto\zero.h|18|error: wx/settings.h: No such file or directory|
I:\My Documents\CodeBlocks C++\pluto\zero.h|19|error: wx/textctrl.h: No such file or directory|
I:\My Documents\CodeBlocks C++\pluto\zero.h|20|error: wx/button.h: No such file or directory|
I:\My Documents\CodeBlocks C++\pluto\zero.h|21|error: wx/sizer.h: No such file or directory|
I:\My Documents\CodeBlocks C++\pluto\zero.h|22|error: wx/panel.h: No such file or directory|
I:\My Documents\CodeBlocks C++\pluto\zero.h|31|error: expected class-name before '{' token|
I:\My Documents\CodeBlocks C++\pluto\zero.h|38|error: expected ')' before '*' token|
I:\My Documents\CodeBlocks C++\pluto\zero.h|48|error: expected class-name before '{' token|
I:\My Documents\CodeBlocks C++\pluto\zero.h|52|error: ISO C++ forbids declaration of 'wxTextCtrl' with no type|
I:\My Documents\CodeBlocks C++\pluto\zero.h|52|error: expected ';' before '*' token|
I:\My Documents\CodeBlocks C++\pluto\zero.h|53|error: ISO C++ forbids declaration of 'wxButton' with no type|
I:\My Documents\CodeBlocks C++\pluto\zero.h|53|error: expected ';' before '*' token|
I:\My Documents\CodeBlocks C++\pluto\zero.h|54|error: ISO C++ forbids declaration of 'wxButton' with no type|
I:\My Documents\CodeBlocks C++\pluto\zero.h|54|error: expected ';' before '*' token|
I:\My Documents\CodeBlocks C++\pluto\zero.h|58|error: expected ')' before '*' token|
I:\My Documents\CodeBlocks C++\pluto\zeroMyFrame1.h|18|error: expected ')' before '*' token|
I:\My Documents\CodeBlocks C++\pluto\zeroMyFrame1.cpp|3|error: expected ')' before '*' token|
||=== Build finished: 24 errors, 0 warnings ===|

--- End code ---



the .cpp files
---------


--- Code: ---///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////

#ifndef __ZERO_H__
#define __ZERO_H__

#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/string.h>
#include <wx/frame.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/panel.h>

///////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
/// Class MyFrame1
///////////////////////////////////////////////////////////////////////////////
class MyFrame1 : public wxFrame
{
private:

protected:

public:

MyFrame1( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("zero"), const wxPoint& pos = wxPoint( 100,100 ), const wxSize& size = wxSize( 600,400 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );

~MyFrame1();

};

///////////////////////////////////////////////////////////////////////////////
/// Class MyPanel1
///////////////////////////////////////////////////////////////////////////////
class MyPanel1 : public wxPanel
{
private:

protected:
wxTextCtrl* m_textCtrl1;
wxButton* m_button1;
wxButton* m_button2;

public:

MyPanel1( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 600,400 ), long style = wxTAB_TRAVERSAL );
~MyPanel1();

};

#endif //__ZERO_H__

--- End code ---




--- Code: ---#include "zeroMyFrame1.h"

zeroMyFrame1::zeroMyFrame1( wxWindow* parent )
:
MyFrame1( parent )
{

}

--- End code ---




--- Code: ---#include "zeroMyPanel1.h"

zeroMyPanel1::zeroMyPanel1( wxWindow* parent )
:
MyPanel1( parent )
{

}
--- End code ---



the .h files
------------



--- Code: ---///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////

#ifndef __ZERO_H__
#define __ZERO_H__

#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/string.h>
#include <wx/frame.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/panel.h>

///////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
/// Class MyFrame1
///////////////////////////////////////////////////////////////////////////////
class MyFrame1 : public wxFrame
{
private:

protected:

public:

MyFrame1( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("zero"), const wxPoint& pos = wxPoint( 100,100 ), const wxSize& size = wxSize( 600,400 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );

~MyFrame1();

};

///////////////////////////////////////////////////////////////////////////////
/// Class MyPanel1
///////////////////////////////////////////////////////////////////////////////
class MyPanel1 : public wxPanel
{
private:

protected:
wxTextCtrl* m_textCtrl1;
wxButton* m_button1;
wxButton* m_button2;

public:

MyPanel1( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 600,400 ), long style = wxTAB_TRAVERSAL );
~MyPanel1();

};

#endif //__ZERO_H__

--- End code ---




--- Code: ---#ifndef __zeroMyFrame1__
#define __zeroMyFrame1__

/**
@file
Subclass of MyFrame1, which is generated by wxFormBuilder.
*/

#include "zero.h"

//// end generated include

/** Implementing MyFrame1 */
class zeroMyFrame1 : public MyFrame1
{
public:
/** Constructor */
zeroMyFrame1( wxWindow* parent );
//// end generated class members

};

#endif // __zeroMyFrame1__

--- End code ---




--- Code: ---#ifndef __zeroMyPanel1__
#define __zeroMyPanel1__

/**
@file
Subclass of MyPanel1, which is generated by wxFormBuilder.
*/

#include "zero.h"

//// end generated include

/** Implementing MyPanel1 */
class zeroMyPanel1 : public MyPanel1
{
public:
/** Constructor */
zeroMyPanel1( wxWindow* parent );
//// end generated class members

};

#endif // __zeroMyPanel1__

--- End code ---



i presume it is something fundamental that i am doing wrong. the problem seems to be the missing header files/other. i am just about stuck... any ideas?

thanks!
 

zabzonk:
I thought we went through all this yesterday? You have to tell codeblocks the location of the wxwidgets installation!

And BTW, names beginning with double underscores or underscores and uppercase letters are not allowed in user C++ code - they are reserved for the C++ implementation.

MortenMacFly:
...in addition: Having characters like "+" in the path might sooner or later cause errors, too. For development, I'd suggest you prefer simple path names (letters and numbers), probably even without spaces to avoid conflicts across platforms. Of course, this does not apply for the runtime version of your application.

Navigation

[0] Message Index

[#] Next page

Go to full version