Author Topic: Setting up code blocks so that I can compile wxwidgets programs.  (Read 23695 times)

Xaviou

  • Guest
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #15 on: April 11, 2006, 09:14:46 pm »
Hi'
I wrote a small tut for setting up C::B and wxWidgets 2.6.3.
I just explain how to obtain DevPacks, how to unpack it, and how to use it with C::B
You can get it here : http://www.cppfrance.com/codes/UTILISATION-WXWIDGETS-SOUS-CODE-BLOCKS_36817.aspx
I'm sorry, but it's in french, but it may help you.
If you need a translation of it, I can do it for you, but I think you've heard about french peoples and foreign languages... :?

Offline djsbriscoe

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #16 on: April 12, 2006, 01:10:06 pm »
Hi,
I've just compiled wxwidgets 2.6.2.
The following warning kept appearing during compilation

warning:type attributes are honored only at type definition.

Is this anything to worry about?

The final line was

Creating library file: ..\..\lib\gcc_dll\libwxmsw26u.a

Is this a correct result?

Is there anything else I need to do in order to start compiling wxwidget programs?

Thanks,

David.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #17 on: April 12, 2006, 01:18:34 pm »
The following warning kept appearing during compilation

warning:type attributes are honored only at type definition.

Is this anything to worry about?

No :).

The final line was

Creating library file: ..\..\lib\gcc_dll\libwxmsw26u.a

Is this a correct result?

If the library has been created, yes :). Look into the gcc_dll repository.

Best wishes,
Michael

Offline djsbriscoe

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #18 on: April 13, 2006, 11:26:25 am »
Hi,
I'm having problems compiling a sample file called minimal.cpp from the wxwidgets distribution.
I don't really know which wxwidget options to choose when setting up a new project.
I get the following errors/warnings when trying to compile minimal.cpp.
I've set the global variable to c:\wxwidgets-2.6.2 I think. How can I check this?

C:\wxWidgets-2.6.2\include\wx\platform.h:190: wx/setup.h: No such file or directory
C:\wxWidgets-2.6.2\include\wx\chkconf.h:84: #error "wxUSE_DYNLIB_CLASS must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:92: #error "wxUSE_EXCEPTIONS must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:100: #error "wxUSE_FILESYSTEM must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:113: #error "wxUSE_DYNAMIC_LOADER must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:121: #error "wxUSE_LOG must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:129: #error "wxUSE_LONGLONG must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:137: #error "wxUSE_MIMETYPE must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:153: #error "wxUSE_PROTOCOL must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:195: #error "wxUSE_REGEX must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:203: #error "wxUSE_STDPATHS must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:211: #error "wxUSE_XML must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:219: #error "wxUSE_SOCKETS must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:227: #error "wxUSE_STREAMS must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:235: #error "wxUSE_STOPWATCH must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:243: #error "wxUSE_TEXTBUFFER must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:251: #error "wxUSE_TEXTFILE must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:267: #error "wxUSE_URL must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:285: #error "wxUSE_ACCEL must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:293: #error "wxUSE_BMPBUTTON must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:301: #error "wxUSE_BUTTON must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:309: #error "wxUSE_CALENDARCTRL must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:317: #error "wxUSE_CARET must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:325: #error "wxUSE_CHECKBOX must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:341: #error "wxUSE_CHOICE must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:349: #error "wxUSE_CHOICEBOOK must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:357: #error "wxUSE_CHOICEDLG must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:365: #error "wxUSE_CLIPBOARD must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:373: #error "wxUSE_COLOURDLG must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:381: #error "wxUSE_COMBOBOX must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:389: #error "wxUSE_DATAOBJ must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:397: #error "wxUSE_DATEPICKCTRL must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:405: #error "wxUSE_DISPLAY must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:413: #error "wxUSE_DOC_VIEW_ARCHITECTURE must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:421: #error "wxUSE_FILEDLG must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:429: #error "wxUSE_FONTDLG must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:437: #error "wxUSE_FONTMAP must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:445: #error "wxUSE_GAUGE must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:453: #error "wxUSE_GRID must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:461: #error "wxUSE_HELP must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:469: #error "wxUSE_HTML must be defined."
clude\wx\chkconf.h:477: #error "wxUSE_XRC must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:498: #error "wxUSE_ICO_CUR must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:506: #error "wxUSE_IFF must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:514: #error "wxUSE_IMAGLIST must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:522: #error "wxUSE_JOYSTICK must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:530: #error "wxUSE_LISTBOOK must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:538: #error "wxUSE_LISTBOX must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:546: #error "wxUSE_LISTCTRL must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:554: #error "wxUSE_LOGGUI must be defined."

Can someone give me a clue as to whats wrong?
Thank you all for your patience and any help is appreciated.

David.

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #19 on: April 13, 2006, 01:17:07 pm »
C:\wxWidgets-2.6.2\include\wx\platform.h:190: wx/setup.h: No such file or directory

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #20 on: April 13, 2006, 01:48:54 pm »
You have to include *both* the include directory under your wxWidgets folder and \lib\gcc_dll\mswu_or_whatever_your_build, as the compiler will need
1. include files from within the include directory
2. the file setup.h which is in a subdirectory of your library folder

The "good" way of doing this is to use the wx global variable (see the WiKi for more information on this subject) and set those paths relative to it, since then your project is arbitrarily relocateable (setting the variable alone is not sufficient, of course).

The template coming with Code::Blocks does that correctly, so if you start your project from the template, you should be fine.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline djsbriscoe

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #21 on: April 13, 2006, 05:06:24 pm »
Hi,
If I want to set up a new wxwidget application as a new project there are 4 options to choose from and I dont know what to choose (something todo with static DLL's etc which I don't understand).
Regarding settings -> global variable I have C:\wxWidgets-2.6.2\ as the base directory. I cant figure out what to put in the include and lib boxes.
Where do I put the path C:\wxWidgets-2.6.2\lib\gcc_dll\mswu\wx (where setup.h is)?
What directories do I put in the directories setting of the settings -> compiler and debugger -> directories box?
Nothing has been set up automatically by the wxwidget template.
What is WX_CFG= used for under build options?
I have looked at the wiki and can't find anything that answers my questions.
I hope someone can clear up my confusion a bit.

Regards,

David.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #22 on: April 13, 2006, 07:11:26 pm »
If I want to set up [...] I dont know what to choose
[...]
Regarding settings -> global variable I have C:\wxWidgets-2.6.2\ as the base directory. I cant figure out what to put in the include and lib boxes.
Read my above post, or read the WiKi, both explains in detail what to do.

Nothing has been set up automatically by the wxwidget template.
Why do you say that?

As you can very well see, the template sets up everything just fine:






"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline ptruog

  • Single posting newcomer
  • *
  • Posts: 3
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #23 on: April 13, 2006, 09:26:28 pm »
Can you provide the Tutorial on the codeblocks wiki?  I tried to download the pdf (presumably the tutorial) from that french site and it requires a login etc.. 

mais, je ne parle pas

Many thanks

Offline djsbriscoe

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #24 on: April 15, 2006, 01:55:21 pm »
Hi,
I am still having problems compiling the following wxwidgets program.
Could someone PLEASE help me to figure out what the problem is.
I will supply ANY information thats needed and work with whoever can help me to come
to a resolution for these problems with compiling.

Have I missed out an important step after compiling wxwidgets?
Am I geting all my paths mixed up?
What about any environment variables in windows 2000, what are essential for C:B,mingw and wxwidgets operation?

Any way here is the program I am trying to compile, could someone try it on their setup of C:B and see if it works.
If it doesnt can someone give me an example that works for them so I can try it out,Thanks.

PS I am using C:B version 1 revision 2334.

//Main source file.

#include <wx/wx.h>
#include "basic.h"
IMPLEMENT_APP(BasicApplication)
bool BasicApplication::OnInit()
{
 BasicFrame *frame = new BasicFrame("Basic", 50, 50, 450, 300);
 frame->Show(TRUE);
 SetTopWindow(frame);
 return TRUE;
}
BasicFrame::BasicFrame
(const wxChar *title,
int xpos, int ypos,
int width, int height)
: wxFrame
( (wxFrame *) NULL,
-1,
title,
wxPoint(xpos, ypos),
wxSize(width, height)
)
{
}
BasicFrame::~BasicFrame()
{
}

//The headers I've added.
//BASIC.H

#include <wx/wx.h>
#include "basic.h"
IMPLEMENT_APP(BasicApplication)
bool BasicApplication::OnInit()
{
 BasicFrame *frame = new BasicFrame("Basic", 50, 50, 450, 300);
 frame->Show(TRUE);
 SetTopWindow(frame);
 return TRUE;
}
BasicFrame::BasicFrame
(const wxChar *title,
int xpos, int ypos,
int width, int height)
: wxFrame
( (wxFrame *) NULL,
-1,
title,
wxPoint(xpos, ypos),
wxSize(width, height)
)
{
}

//Headers addded by code:blocks
//PLATFORM.H

//Header added by code:blocks
//wx_pch.h


//Also include by code:blocks is chkconf.h

//Resource file I have addded.
//basic_resource.rc

#include "wx/msw/wx.rc"

//ERRORS I get when compiling this program.

C:\wxWidgets-2.6.2\include\wx\platform.h:190: wx/setup.h: No such file or directory
C:\wxWidgets-2.6.2\include\wx\chkconf.h:84: #error "wxUSE_DYNLIB_CLASS must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:92: #error "wxUSE_EXCEPTIONS must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:100: #error "wxUSE_FILESYSTEM must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:113: #error "wxUSE_DYNAMIC_LOADER must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:121: #error "wxUSE_LOG must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:129: #error "wxUSE_LONGLONG must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:137: #error "wxUSE_MIMETYPE must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:153: #error "wxUSE_PROTOCOL must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:195: #error "wxUSE_REGEX must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:203: #error "wxUSE_STDPATHS must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:211: #error "wxUSE_XML must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:219: #error "wxUSE_SOCKETS must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:227: #error "wxUSE_STREAMS must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:235: #error "wxUSE_STOPWATCH must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:243: #error "wxUSE_TEXTBUFFER must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:251: #error "wxUSE_TEXTFILE must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:267: #error "wxUSE_URL must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:285: #error "wxUSE_ACCEL must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:293: #error "wxUSE_BMPBUTTON must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:301: #error "wxUSE_BUTTON must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:309: #error "wxUSE_CALENDARCTRL must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:317: #error "wxUSE_CARET must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:325: #error "wxUSE_CHECKBOX must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:341: #error "wxUSE_CHOICE must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:349: #error "wxUSE_CHOICEBOOK must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:357: #error "wxUSE_CHOICEDLG must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:365: #error "wxUSE_CLIPBOARD must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:373: #error "wxUSE_COLOURDLG must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:381: #error "wxUSE_COMBOBOX must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:389: #error "wxUSE_DATAOBJ must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:397: #error "wxUSE_DATEPICKCTRL must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:405: #error "wxUSE_DISPLAY must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:413: #error "wxUSE_DOC_VIEW_ARCHITECTURE must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:421: #error "wxUSE_FILEDLG must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:429: #error "wxUSE_FONTDLG must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:437: #error "wxUSE_FONTMAP must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:445: #error "wxUSE_GAUGE must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:453: #error "wxUSE_GRID must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:461: #error "wxUSE_HELP must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:469: #error "wxUSE_HTML must be defined."
clude\wx\chkconf.h:477: #error "wxUSE_XRC must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:498: #error "wxUSE_ICO_CUR must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:506: #error "wxUSE_IFF must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:514: #error "wxUSE_IMAGLIST must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:522: #error "wxUSE_JOYSTICK must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:530: #error "wxUSE_LISTBOOK must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:538: #error "wxUSE_LISTBOX must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:546: #error "wxUSE_LISTCTRL must be defined."
C:\wxWidgets-2.6.2\include\wx\chkconf.h:554: #error "wxUSE_LOGGUI must be defined."


//My entries in global variable editor.

variable: wx
base directory: C:\wxWidgets-2.6.2\
include: empty
lib: C:\wxWidgets-2.6.2\lib\gcc_dll\mswu\wx (setup.h is here)

//My entries in global compiler setting -> directories
 
c:\wxwidgets-2.6.2\include
C:\wxWidgets-2.6.2\lib\gcc_dll\mswu\wx

Thank you anyone who has taken the time to read this post and I really appreciate it. Without someones help I feel I will soon give up.

Regards and thanks,

David.


Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #25 on: April 15, 2006, 04:06:13 pm »
Your "header" file contains the same as your source file.
Not only will that fail because your classes are not declared, but you also create an infinite #include loop (the compiler will abort after 100 or so inclusions). Regardless of everything else, this will not compile.

The error messages that you posted are not related to that, however. They are purely due to improper compiler path setup.

You should have taken 30 seconds to read my above posts regarding this path setup. But I am very well willing to repeat myself again:
Either set up the paths as in the screenshot and set the wx variable to where your wxWidgets installation lives, or better, use the template (the template will do it correctly).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline squizzz

  • Almost regular
  • **
  • Posts: 132
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #26 on: April 15, 2006, 05:18:12 pm »
@djsbriscoe - check this. :P

And since you are starting with wxWidgets, you might find these 2 places very helpful:
Official wxWidgets forum
mailing list: comp.soft-sys.wxwindows
« Last Edit: April 15, 2006, 05:23:27 pm by squizzz »
this space is for rent

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #27 on: April 15, 2006, 08:36:55 pm »
Hello,

This book could also be very useful :).

Best wishes,
Michael

Offline djsbriscoe

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #28 on: April 15, 2006, 11:58:47 pm »
Hi,
Thank you for your help so far :)

I have one last problem, this error

C:\wxWidgets-2.6.2\include\wx\msw\wx.rc:104: warning: no newline at end of file

I've tried adding a newline at the end of the line but the compiler still complains. Can I change the output parsing order in advanced compiler options, if so how exactly?

Lets hope I can get this last problem sorted.

Michael I've downloaded the book you mentioned and thats the book I'm going to learn from,Thanks. Thomas thanks for being patient. Squizz I followed the advice to copy setup.h to another directory and this solved the setup.h problem.
Thanks also to everyone else I havent mentioned.

David.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Setting up code blocks so that I can compile wxwidgets programs.
« Reply #29 on: April 16, 2006, 12:11:05 am »
I have one last problem, this error

C:\wxWidgets-2.6.2\include\wx\msw\wx.rc:104: warning: no newline at end of file

I've tried adding a newline at the end of the line but the compiler still complains.

Lets hope I can get this last problem sorted.

Hello,

it is not an error, but a warning. Normally there shoulld be a newline at the end of a file (.h & -cpp). Add a new line (an empty line) should stop the compiler to complain about. Anyway, the file in question concerns the wxWidgets library.

Best wishes,
Michael