building codeblocks 7860 with codeblocks(svn 7785) in ubuntu 10.04 i get this error:
main.cpp In member function ‘void MainFrame::OnFileSaveAll(wxCommandEvent&)’
main.cpp 2694 error: ‘class ConfigManager’ has no member named ‘Flush’
and i dont know how to solve it, help please
Some benchmarks:
no pch all plugins
real 6m3.471s
user 17m28.232s
sys 1m4.067s
with pch all plugins
real 5m29.323s
user 15m29.386s
sys 1m4.443s
no pch core only
real 2m16.697s
user 6m47.092s
sys 0m22.004s
with pch core only
real 1m55.610s
user 5m17.441s
sys 0m21.784s
Linux, make -j5, gcc 4.5.3 core2quad 6600 @ 3.2 ghz.
I don't see what is the benefit of pch. I see only pain...
Morten: Can we make C::B delete the .gch files automatically, when the user executes clean or rebuild?
In both cases they already should be cleaned automatically. The error IMHO occurs because people don't clean or re-build, they just do a build.
I click the "clean" button, but I found that ".o" files were deleted by C::B. But unfortunately, the PCH files still exist. They are:
cb_trunk\src\include\sdk_precomp.h.gch
and
cb_trunk\src\include\sdk.h.gch
So, my question is: can we delete those .gch files when we press the "clean" button?
EDIT:
Oh, it looks like now the pch files were put seperatedly by wx28 project(under .objs\include) and wx29 project(under .objs29\include).
EDIT2
Ok, I see the change in 2012-02-15
src/CodeBlocks.cbp | 19 +++----------------
1 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/src/CodeBlocks.cbp b/src/CodeBlocks.cbp
index 4457729..75e069f 100644
--- a/src/CodeBlocks.cbp
+++ b/src/CodeBlocks.cbp
@@ -2,8 +2,7 @@
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
- <Option title="Code::Blocks" />
- <Option pch_mode="2" />
+ <Option title="Code::Blocks wx2.8.x" />
<Option default_target="src" />
<Option compiler="gcc" />
<Build>
So, we have change the pch generate mode (output directory). PCH deleting should work OK.
Oh, it looks like now the pch files were put seperatedly by wx28 project(under .objs\include) and wx29 project(under .objs29\include).
True, I did that because otherwise they conflict. But thats another interesting issue: You guys might have an old PCH file which is used first due to the include order... So it might not work because of this.
we should be honest after all those years and say we just don't know how to do it, or we just keep on failing to do it right.
Well, we know how. And after all, the NON-PCH compilation (I mean with NOPCH switch, that's different from simply disabling PCH!) will be helpful to detect missing includes. Keep in mind that no matter what we do - wx will do and use PCH unless we declare NOPCH at the compile time. So even if we disable our PCH, the patches won't stop unless we do it properly in the first place.
The rules are plain simple:
PCH file:
- include all rarely changing header files
- do the PCH macro vodoo (we have that already)
Header:
- If you access or define an object, include the header
- If you use pointers/references, use forward decl
- Put headers you need to include into such a section if they are part of your PCH file:
#ifndef USE_PCH
#include <wx/dialog.h>
#endif
- Include headers you need to include that are not part of your PCH file as normal
Implementation:
- include the PCH file first
- same thing for headers needed as in the header file.
I do it that way in my own projects and i works flawlessly for ages! Of course, whenever I change code and use new classes, I need to check the above rules.
But (nevermind) if we decide to get rid of this because these rules are too hard - go ahead.
Here comes a simple small class:
Header:
#ifndef USE_PCH
#include <wx/dialog.h> // is in wx_pch.h!
#endif
#include <wx/busyinfo.h> // NOT in wx_pch.h and used as object
class MyClass; // forward decsl due to pointer usage
class MyDlg: public wxDialog
{
MyDlg() { ; };
void Func(MyClass* c); // used as pointer
wxBusyInfo bi; // used as object
}
Implementation:
#include <wx_pch.h> // our PCH file, may include the WX PCH file (if needed)
#include "MyDlg.h"
#ifndef USE_PCH
#include "MyClass.h" // is in wx_pch.h, but now used as object / accessed
#endif
#include "MyOhterClass.h" // NOT in wx_pch.h and used as object
void MyDlg::Func(MyClass* c)
{
MyOtherClass moc;
c->DoSomething(moc);
}
...that's basically it (if I didn't forget something... ;-)).