News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Can't build CodeBlocks (wxCheckListBox not declared)

Started by Azra, March 01, 2008, 07:40:34 PM

Previous topic - Next topic

Azra

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]

thomas

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."

Azra

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:
#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...

Jeisson

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!

gomer

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

gomer

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

oBFusCATed

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!]

Jenna

Quote from: 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...


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:
Quote from: 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.

But gomer only deleted one of two pch's:
Quote from: gomer on July 02, 2009, 08:23:26 PM
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.