Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Azra on March 01, 2008, 07:40:34 pm

Title: Can't build CodeBlocks (wxCheckListBox not declared)
Post by: Azra on March 01, 2008, 07:40:34 pm
I don't really know anything about CB's insides, so I don't feel like editing any code on my own  :? .. Can anyone tell me what's wrong here (look at image)

[attachment deleted by admin]
Title: Re: Can't build CodeBlocks (wxCheckListBox not declared)
Post by: thomas on March 01, 2008, 09:34:55 pm
If you have built Code::Blocks before (maybe a few weeks or months ago), it may be a conflict with precompiled headers. Deleting them should fix the problem.

If that is not the case, I guess it might be something wrong with your wxWidgets build.
Rationale:
1. it works for me
2. it says wxCheckListBox was not declared
3. it does not complain that it couldn't find a header file

Something not being declared usually has two possible causes (apart from the obvious cause that it simply doesn't exist). Either, it is not declared because some #ifdef/#ifndef disables it, or the header was not included due to incorrect include paths.
If there was a problem with your include paths, the compiler would complain "cannot find include file", but it doesn't.
Title: Re: Can't build CodeBlocks (wxCheckListBox not declared)
Post by: Azra on March 01, 2008, 10:30:21 pm
I've checked the header file, where wxCheckListBox is declared and found out, that it's not included explicitly. But there are these lines in the wx/checklst.h which IS included:
Code
#if defined(__WXUNIVERSAL__)
    #include "wx/univ/checklst.h"
#elif defined(__WXWINCE__)
    #include "wx/msw/wince/checklst.h"
#elif defined(__WXMSW__)
    #include "wx/msw/checklst.h"
#elif defined(__WXMOTIF__)
    #include "wx/motif/checklst.h"
#elif defined(__WXGTK20__)
    #include "wx/gtk/checklst.h"
#elif defined(__WXGTK__)
    #include "wx/gtk1/checklst.h"
#elif defined(__WXMAC__)
    #include "wx/mac/checklst.h"
#elif defined(__WXCOCOA__)
    #include "wx/cocoa/checklst.h"
#elif defined(__WXPM__)
    #include "wx/os2/checklst.h"
#endif

each of theese files contains the declaration of wxCheckListBox.

I've checked the #defines in the build options - __WXMSW__ is defined. I don't understand what the problem is...
Title: Re: Can't build CodeBlocks (wxCheckListBox not declared)
Post by: Jeisson on June 10, 2008, 05:40:48 am
I had also this problem. I discovered it is related to wxSmith plugin, when the automatic generated code moves the <wx/checklst.h> include to the top of the list, in the header of the dialog/frame you are editing. When I moved this include to the bottom of the headers, the project compiled again.

I do not know the cause. I hope it could be fixed.
So many thanks for this wonderful IDE!
Title: Re: Can't build CodeBlocks (wxCheckListBox not declared)
Post by: gomer on July 02, 2009, 08:23:26 pm
Hi,

I also have the same problem compiling CB (in compileroptionsdlg.cpp).  I tried moving the #include <wx/checklst.h> to the bottom of the list of headers, but that did not help.I also tried deleting the precompiled header (sdk_precomp.h.gch). I built wxWidgets as per the instructions in "Installing CodeBlocks from source on Windows - CodeBlocks.htm".  Has this issue been fixed? (my CB source is from Nov 20,2008 and wx is wxWidgets-2.8.10).

thanx
Title: Re: Can't build CodeBlocks (wxCheckListBox not declared)
Post by: gomer on July 03, 2009, 06:04:01 pm
Hi again,

I think I have found the problem (and solution). I deleted both pre-compiled headers in codeblocks\src\include (sdk.h.gch and sdk_precomp.h.gch), and then rebuilt CB.  It worked.
cheers
Title: Re: Can't build CodeBlocks (wxCheckListBox not declared)
Post by: oBFusCATed on July 03, 2009, 11:06:48 pm
Hm, When you hit "rebuild all" is the .gch file being deleted? If not why?
This is question to the devs...
Title: Re: Can't build CodeBlocks (wxCheckListBox not declared)
Post by: Jenna on July 04, 2009, 09:59:14 am
Hm, When you hit "rebuild all" is the .gch file being deleted? If not why?
This is question to the devs...


They get deleted if you hit rebuild or clean, but not if you just hit build.

That's the danger when using precompiled headers. If you change a header, that belongs to the precompiled header the compiler does not notice it, because it's already included by the preocompiled header, even if it's not the actual version.

gcc always uses a precompiled header if it exists and does not check the headers for changes, if they are included by the pch, so cleaning or manually deleting is recommended.

And as thomas wrote before:
If you have built Code::Blocks before (maybe a few weeks or months ago), it may be a conflict with precompiled headers. Deleting them should fix the problem.

But gomer only deleted one of two pch's:
I also tried deleting the precompiled header (sdk_precomp.h.gch).

That's most likely the problem in this case: we have two precompiled headers, one for C::B itself and one for the plugins, because they need different defines, but use the same headers, so both have to be deleted, or you use different headers for C::B and the plugins and that will most likely break the build and/or the application.