Author Topic: Can't build CodeBlocks (wxCheckListBox not declared)  (Read 5519 times)

Offline Azra

  • Single posting newcomer
  • *
  • Posts: 9
Can't build CodeBlocks (wxCheckListBox not declared)
« 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]

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Can't build CodeBlocks (wxCheckListBox not declared)
« Reply #1 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Azra

  • Single posting newcomer
  • *
  • Posts: 9
Re: Can't build CodeBlocks (wxCheckListBox not declared)
« Reply #2 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...

Offline Jeisson

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: Can't build CodeBlocks (wxCheckListBox not declared)
« Reply #3 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!

Offline gomer

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Can't build CodeBlocks (wxCheckListBox not declared)
« Reply #4 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
« Last Edit: July 02, 2009, 09:19:33 pm by gomer »

Offline gomer

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Can't build CodeBlocks (wxCheckListBox not declared)
« Reply #5 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
« Last Edit: July 03, 2009, 06:14:12 pm by gomer »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can't build CodeBlocks (wxCheckListBox not declared)
« Reply #6 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...
(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!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Can't build CodeBlocks (wxCheckListBox not declared)
« Reply #7 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.