Author Topic: wxsmith - fatal error wx/dialog.h: no such file or directory  (Read 20697 times)

Offline blue orb

  • Multiple posting newcomer
  • *
  • Posts: 25
wxsmith - fatal error wx/dialog.h: no such file or directory
« on: November 02, 2011, 10:46:42 pm »
Hi, so i am new to c++ and therefore code::blocks... have done a lot of googling and have managed to learn quite alot. generally, i am happy with my progress to date. i am using the MinGw 64-bit compiler. my system is windows 7 64-bit home premium. eventually, i want to build a RPG gui-based game. i've been using the wxsmith gui building tools to get a feel for it. building the gui isn't a major problem. i have a project with a main.ccp an other.cpp and a header.h file. with them, there are the two files that i have cut and pasted below = they are the gui files (one .ccp and the other a .h header file). now, all is okay until i try to compile the thing... the compiler gives me the fatal warning  stating that there are missing files/directories.

is this because i haven't developed the gui facets enough? i don't think that is the problem here. if only things just worked... any help is good help, i think. thanks for any advice you might be able to offer.


MyDialog.cpp
---------------

#include "MyDialog.h"

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

//(*IdInit(MyDialog)
const long MyDialog::ID_SPINBUTTON1 = wxNewId();
//*)

BEGIN_EVENT_TABLE(MyDialog,wxDialog)
   //(*EventTable(MyDialog)
   //*)
END_EVENT_TABLE()

MyDialog::MyDialog(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
   //(*Initialize(MyDialog)
   Create(parent, id, _("Bass"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id"));
   SetClientSize(wxSize(800,600));
   Move(wxPoint(100,100));
   SetBackgroundColour(wxColour(129,130,94));
   SpinButton1 = new wxSpinButton(this, ID_SPINBUTTON1, wxPoint(208,216), wxDefaultSize, wxSP_VERTICAL|wxSP_ARROW_KEYS, _T("ID_SPINBUTTON1"));
   SpinButton1->SetRange(0, 100);
   //*)
}

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



MyDialog.h
-------------

#ifndef MYDIALOG_H
#define MYDIALOG_H

//(*Headers(MyDialog)
#include <wx/dialog.h>
#include <wx/spinbutt.h>
//*)

class MyDialog: public wxDialog
{
   public:

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

      //(*Declarations(MyDialog)
      wxSpinButton* SpinButton1;
      //*)

   protected:

      //(*Identifiers(MyDialog)
      static const long ID_SPINBUTTON1;
      //*)

   private:

      //(*Handlers(MyDialog)
      //*)

      DECLARE_EVENT_TABLE()
};

#endif


Thanks :)

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #1 on: November 02, 2011, 11:01:49 pm »
It sounds like you do not have the wxWidgets library (properly) installed/setup.  Refer to the documentation of how to do this on the Code::Blocks wiki (or possibly more up-to-date for building, the wxWidgets wiki).

By the way, whenever posting code or logs of some sort, please use code tags.

Offline blue orb

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #2 on: November 02, 2011, 11:50:30 pm »
hello, i had wxWidgets 2.8.12 installed on my system, but i couldn't find any way to run it = no icon, or wotnot. how can i launch it? i have just installed wxWidgets 2.9.2 and, again, no icon or anything to launch the application... how is it done? from within code::blocks?



zabzonk

  • Guest
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #3 on: November 03, 2011, 12:03:51 am »
wxWidgets is not an application. It's a library, and one that must be built and then linked with your application. Building wxWidgets on Windows is a bit fraught, so you may want to use the pre-compiled version which you can get from wxPack at http://wxpack.sourceforge.net.

Also, for a beginner programmer I would not recommend using the 64-bit version of MinGW. Just because your platform is notionally 64-bit does not mean that you have to use a 64-bit compiler. Use the 32-bit one at http://tdm-gcc.tdragon.net

Offline blue orb

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #4 on: November 03, 2011, 09:27:17 am »
after a complete re-install of code::blocks, i am back using minGW 32-bit. now, the 32-bit version is throwing-up lots more errors than minGW 64-bit did. do i need to configure wxsmith for current project? i didn't want to tamper with its settings too much. other than that, the settings ==> global variables ==> builtin fields?

Code
[code||=== bass, Debug ===|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.h|6|error: wx/dialog.h: No such file or directory|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.h|7|error: wx/spinbutt.h: No such file or directory|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.h|8|error: wx/combobox.h: No such file or directory|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.cpp|4|error: wx/intl.h: No such file or directory|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.cpp|5|error: wx/string.h: No such file or directory|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.h|12|error: expected class-name before '{' token|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.h|15|error: expected ')' before '*' token|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.h|19|error: ISO C++ forbids declaration of 'wxSpinButton' with no type|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.h|19|error: expected ';' before '*' token|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.h|20|error: ISO C++ forbids declaration of 'wxComboBox' with no type|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.h|20|error: expected ';' before '*' token|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.h|35|error: ISO C++ forbids declaration of 'DECLARE_EVENT_TABLE' with no type|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.h|36|error: expected ';' before '}' token|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.h|36|error: expected ';' before '}' token|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.cpp|9|error: 'wxNewId' was not declared in this scope|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.cpp|10|error: 'wxNewId' was not declared in this scope|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.cpp|13|error: 'wxDialog' has not been declared|
I:\My Documents\CodeBlocks C++\bass - Copy (3)\MyDialog.cpp|16|error: expected constructor, destructor, or type conversion before 'END_EVENT_TABLE'|
||=== Build finished: 18 errors, 0 warnings ===|
]

« Last Edit: November 03, 2011, 09:31:48 am by blue orb »

zabzonk

  • Guest
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #5 on: November 03, 2011, 09:52:54 am »
To write wxWidget applications, you need the wxWidgets libraries and header files. These are not part of Code::Blocks or of the GCC compiler, but must be installed separately.  You can get a pre-built version of the wxWidgets libraries from wxPack at http://wxpack.sourceforge.net.  If you do not use wxPack, you will have to build wxWidgets yourself - this is not something I would recommend you try doing.

Have you installed wxWidgets?


Offline blue orb

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #6 on: November 03, 2011, 10:17:19 am »
i have both wxWidgets 2.8.12 and wxWidgets 2.9.2 installed. i have also installed wxPack. how do i link wxPack to code::blocks?

thanks!

zabzonk

  • Guest
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #7 on: November 03, 2011, 10:24:47 am »
When you create a wxWidgets project in Code::Blocks, one of the things the Project Wizard asks you is for the directory you installed wxWidgets in (the one that contains the include and lib directories). Start a new wxProject, and make sure that this setting is set correctly, pointing to the wxPack installation.

I've just done this, and built the small Hello World wxWidget project with no problems.

Offline blue orb

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #8 on: November 03, 2011, 10:55:07 am »
the wxPack folder (on my c: drive) only contains a few files + an unistaller. it isn't very populated. does wxPack install to another location, too? though wxFormBuilder installed okay and is working.fine. the question i really want to ask, is, how are wxsmith, wxWidgets, wxPack, code::blocks and wxFormBuilder interweaved?

zabzonk

  • Guest
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #9 on: November 03, 2011, 11:05:09 am »
That is the directory used by the installer. When you ran the wxPack installer, it will have asked you "Where should wxWidgets Compiled be installed?" It is that directory that contains the include files and libraries.

As for the relationship between the components, wxWidgets is a library. Applications like Code::Blocks, wxFormBuilder, and whatever it is that you are trying to write, use that library.

Offline blue orb

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #10 on: November 03, 2011, 03:14:43 pm »
wxPack was in a folder on my c:drive, named SourceCode. that is now sorted out, i hope. as a note, my code now runs much faster than it did ==over twice as fast infact==. but, i am still getting errors... using wxsmith from within my existing project just halts at the same place as it used to, that's missing header files! a new wxWidgets project mostly compiles but generates the errors in the text that i have added to this post. what else can i do to fix this?


Code
obj\Debug\zeroApp.o||In function `Z11wxCreateAppv':|
I:\My Documents\CodeBlocks C++\zero\zeroApp.cpp|18|undefined reference to `__gxx_personality_sj0'|
I:\My Documents\CodeBlocks C++\zero\zeroApp.cpp|18|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroApp.cpp|18|undefined reference to `operator delete(void*)'|
obj\Debug\zeroApp.o:I:\My Documents\CodeBlocks C++\zero\zeroApp.cpp|21|undefined reference to `__gxx_personality_sj0'|
obj\Debug\zeroApp.o:I:\My Documents\CodeBlocks C++\zero\zeroApp.cpp|27|undefined reference to `operator new(unsigned int)'|
obj\Debug\zeroApp.o:I:\My Documents\CodeBlocks C++\zero\zeroApp.cpp|27|undefined reference to `operator delete(void*)'|
obj\Debug\zeroApp.o:zeroApp.cpp:(.rdata$_ZTI7zeroApp[typeinfo for zeroApp]+0x0)||undefined reference to `vtable for __cxxabiv1::__si_class_type_info'|
obj\Debug\zeroApp.o:zeroApp.cpp:(.rdata$_ZTI5wxApp[typeinfo for wxApp]+0x0)||undefined reference to `vtable for __cxxabiv1::__si_class_type_info'|
obj\Debug\zeroApp.o:zeroApp.cpp:(.rdata$_ZTI9wxAppBase[typeinfo for wxAppBase]+0x0)||undefined reference to `vtable for __cxxabiv1::__si_class_type_info'|
obj\Debug\zeroApp.o:zeroApp.cpp:(.rdata$_ZTI12wxAppConsole[typeinfo for wxAppConsole]+0x0)||undefined reference to `vtable for __cxxabiv1::__si_class_type_info'|
obj\Debug\zeroApp.o:zeroApp.cpp:(.rdata$_ZTI12wxEvtHandler[typeinfo for wxEvtHandler]+0x0)||undefined reference to `vtable for __cxxabiv1::__si_class_type_info'|
obj\Debug\zeroApp.o:zeroApp.cpp:(.rdata$_ZTI8wxObject[typeinfo for wxObject]+0x0)||undefined reference to `vtable for __cxxabiv1::__class_type_info'|
obj\Debug\zeroApp.o||In function `~zeroApp':|
I:\My Documents\CodeBlocks C++\zero\zeroApp.h|16|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroApp.h|16|undefined reference to `operator delete(void*)'|
obj\Debug\zeroMain.o||In function `Z11wxbuildinfo17wxbuildinfoformat':|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|24|undefined reference to `__gxx_personality_sj0'|
obj\Debug\zeroMain.o||In function `zeroFrame':|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|57|undefined reference to `__gxx_personality_sj0'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|69|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|69|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|71|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|72|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|71|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|72|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|73|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|73|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|76|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|76|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|77|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|77|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|81|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|81|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|57|undefined reference to `__gxx_personality_sj0'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|69|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|69|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|71|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|72|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|71|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|72|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|73|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|73|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|76|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|76|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|77|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|77|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|81|undefined reference to `operator new(unsigned int)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|81|undefined reference to `operator delete(void*)'|
obj\Debug\zeroMain.o||In function `~zeroFrame':|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|97|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|97|undefined reference to `operator delete(void*)'|
I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|97|undefined reference to `operator delete(void*)'|
obj\Debug\zeroMain.o:I:\My Documents\CodeBlocks C++\zero\zeroMain.cpp|105|undefined reference to `__gxx_personality_sj0'|
obj\Debug\zeroMain.o||In function `~wxObject':|
C:\SourceCode\Libraries\wxWidgets2.8\include\wx\object.h|413|undefined reference to `operator delete(void*)'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #11 on: November 03, 2011, 03:21:16 pm »
Hi, blue orb:
see: wxPack | Main / HomePage browse
It said:
Quote
07/01/2011
There is a new release of wxPack that supports wxWidgets v2.8.12. This release only has MinGW GCC v4.4.1-tdm_dw2 and Microsoft Visual C++ 10.0 libraries included. Please give feedback. Download now.

Also, you should note that there are two type of mingw GCC. One is SJLJ, and the other is DW2, the wxPack was build from a dw2 version of gcc, so I guess you need to use a dw2 version of GCC. So, you need to use a dw2 version of TDM gcc.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

zabzonk

  • Guest
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #12 on: November 03, 2011, 04:26:08 pm »
@ollydbg

Hmm. I have the "standard" TDM download which is built with:

    --enable-sjlj-exceptions

and this compiles, links and runs perfectly with wxPack.


@blue orb

Those are the errors you tend to get when you link C++ code only with the C runtime libraries. Did you create your project using the wxWidgets project wizard? Is there any way you could have told whatever you created it with that you were writing the code in C?
« Last Edit: November 03, 2011, 04:29:58 pm by Neil Butterworth »

Offline blue orb

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #13 on: November 03, 2011, 04:37:38 pm »
i've just tried the DW2 compiler, and get the same errors. it must be something that i am doing wrong with code::blocks and/or wxFormBuilder? what might the problem be with wxFormBuilder? labelling files wrongly? using generate inherited class wrongly?

zabzonk

  • Guest
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #14 on: November 03, 2011, 04:42:41 pm »
Forget wxformbuilder for the moment. Have you built a simple do-nothing wxWidgets project using the Code::Blocks wxWidgets project Wizard? If so, did it work? If not, please do so.

Offline blue orb

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #15 on: November 03, 2011, 04:46:06 pm »
afaik, i have only ever used c++ files = .h and .cpp. i have never used c files.

the wxWidgets project was a wx\widgets from ground-up.

i will try another wxWidgets project again, now.

Offline blue orb

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #16 on: November 03, 2011, 04:58:52 pm »
just tried a fresh wxWidgets project from within code:blocks. that won't compile either. am i using wxFormBuilder's/code:blocks' gui tools wrongly?

zabzonk

  • Guest
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #17 on: November 03, 2011, 05:07:23 pm »
OK, one last thing. Check that you are building with the correct tools. In Code::Blocks, go to Settings|Compiler and Debugger... and in the resulting dialog select the Toolchain Executables tab. Take a look the C++ Compiler and Linker for Dynamic libs entries - they should both be set to "mingw32-g++.exe". If somehow they have got set to "mingw32-gcc.exe" or something similar, that will cause problems.

If that fails, can you post the build log as an attachment.  You might need to enable its creation in the Compiler and Debugger dialog's Build Options tab. It will be created in your project root directory and will be called something like myproj_build_log.html.


Offline blue orb

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #18 on: November 03, 2011, 05:20:02 pm »
i am so so happy:))

that worked!! the dynamic lib was set wrongly...

thank you for all your help with this!

zabzonk

  • Guest
Re: wxsmith - fatal error wx/dialog.h: no such file or directory
« Reply #19 on: November 03, 2011, 05:21:38 pm »
Hurrah! My good deed for the day!