Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Build C::B against wx3.02 with gcc 5.2 under Windows

<< < (13/25) > >>

ollydbg:

--- Quote from: stahta01 on October 07, 2015, 04:05:52 pm ---FYI: In Windows MinGW GCC a PCH only works inside of a real source file (headers files do NOT count).
In other words, a header can never include a real PCH file.

Edit: If on the command line you include a real PCH file like doing [-incude "sdk.h"] you will get a error normally if a header file in the project also includes that same PCH header of  "sdk.h"; it a weird error message that I forgot what it says.

--- End quote ---
I didn't see the weird error till now.  :)


--- Quote ---Edit2: You will have to put guards around the includes inside some source files around includes of the PCH; never tried the guards around the includes in header files since they needed to be removed I just removed them. 
Tim S.

--- End quote ---
As I said, the modified "sdk.h" I use was like below:

--- Code: ---#ifndef SDK_H
#define SDK_H
#include "sdk_precomp.h"
#endif // SDK_H

--- End code ---
Do you mean, I should wrote something like:

--- Code: ---#ifndef SDK_H
#define SDK_H
#ifndef SDK_PRECOMP_H
#include "sdk_precomp.h"
#endif
#endif // SDK_H
--- End code ---

Ideally, if we share a single pch file for all dlls and exes, we need only one header file(which is included in source files for all sdk, dll targets), such as "sdk.h", "sdk_precomp.h" is not needed here.

stahta01:

--- Quote from: ollydbg on October 07, 2015, 10:40:55 pm ---
--- Quote from: stahta01 on October 07, 2015, 04:05:52 pm ---FYI: In Windows MinGW GCC a PCH only works inside of a real source file (headers files do NOT count).
In other words, a header can never include a real PCH file.

Edit: If on the command line you include a real PCH file like doing [-incude "sdk.h"] you will get a error normally if a header file in the project also includes that same PCH header of  "sdk.h"; it a weird error message that I forgot what it says.

--- End quote ---
I didn't see the weird error till now.  :)


--- Quote ---Edit2: You will have to put guards around the includes inside some source files around includes of the PCH; never tried the guards around the includes in header files since they needed to be removed I just removed them. 
Tim S.

--- End quote ---
As I said, the modified "sdk.h" I use was like below:

--- Code: ---#ifndef SDK_H
#define SDK_H
#include "sdk_precomp.h"
#endif // SDK_H

--- End code ---
Do you mean, I should wrote something like:

--- Code: ---#ifndef SDK_H
#define SDK_H
#ifndef SDK_PRECOMP_H
#include "sdk_precomp.h"
#endif
#endif // SDK_H
--- End code ---

Ideally, if we share a single pch file for all dlls and exes, we need only one header file(which is included in source files for all sdk, dll targets), such as "sdk.h", "sdk_precomp.h" is not needed here.

--- End quote ---

I mean you have to put guards in every source file the includes the "sdk.h" (if that is the PCH file) and you are including it on the command line using [-include "sdk.h"]. Or you can removed every include of the PCH file from inside the source files and header files.

Edit: As I have already mentioned; but, it appears you missed it. Using [-include "sdk.h"] when sdk.h is NOT a PCH file is a waste of time because if it is NOT a PCH file it will compile slower that if it was NOT used as an option.

Tim S.

ollydbg:
Hi, Tim, I am using "-include "sdk_precomp.h"", not using "-include "sdk.h"", since I have only one pch file named "sdk_precomp.h.gch".
Sent from my phone.(sorry I cannot enter too much words)

stahta01:

--- Quote from: ollydbg on October 08, 2015, 04:46:05 pm ---Hi, Tim, I am using "-include "sdk_precomp.h"", not using "-include "sdk.h"", since I have only one pch file named "sdk_precomp.h.gch".
Sent from my phone.(sorry I cannot enter too much words)

--- End quote ---

Good, that means you will only need to fix the code in the SDK folders instead of all the plugins.
I might try doing the same and see what errors I get when I have the time and energy.

Tim S.

ollydbg:

--- Quote from: stahta01 on October 08, 2015, 07:51:00 pm ---
--- Quote from: ollydbg on October 08, 2015, 04:46:05 pm ---Hi, Tim, I am using "-include "sdk_precomp.h"", not using "-include "sdk.h"", since I have only one pch file named "sdk_precomp.h.gch".
Sent from my phone.(sorry I cannot enter too much words)

--- End quote ---

Good, that means you will only need to fix the code in the SDK folders instead of all the plugins.
I might try doing the same and see what errors I get when I have the time and energy.

Tim S.


--- End quote ---
Glad to hear, and this is the patch I made to use single PCH files. Please note that if you use a release version of wxWidgets 3, you do not need to change the Variable WX_SUFFIX from u to ud.


--- Code: --- src/CodeBlocks_wx30.cbp | 83 +++++++++++++++++++++++++++++++++++++++----------
 src/include/sdk.h       |  8 ++---
 2 files changed, 70 insertions(+), 21 deletions(-)

diff --git a/src/CodeBlocks_wx30.cbp b/src/CodeBlocks_wx30.cbp
index 3f63122..ac09ab1 100644
--- a/src/CodeBlocks_wx30.cbp
+++ b/src/CodeBlocks_wx30.cbp
@@ -168,7 +168,10 @@
  <Option parameters="--debug-log --no-dde --no-check-associations --multiple-instance --no-splash-screen --verbose -p debug" />
  <Option projectLinkerOptionsRelation="2" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add directory="include" />
  <Add directory="include/scripting/include" />
  <Add directory="include/scripting/sqplus" />
@@ -226,7 +229,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add directory="include" />
  <Add directory="include/scripting/include" />
  <Add directory="include/scripting/sqplus" />
@@ -260,7 +266,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add option="-DASTYLE_LIB" />
  <Add directory="include" />
  <Add directory="plugins/astyle/astyle" />
@@ -293,7 +302,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add directory="include" />
  </Compiler>
  <Linker>
@@ -338,7 +350,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add directory="include" />
  <Add directory="plugins/compilergcc/depslib/src" />
  <Add directory="include/scripting/include" />
@@ -377,7 +392,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add directory="include" />
  <Add directory="include/scripting/include" />
  <Add directory="include/scripting/sqplus" />
@@ -410,7 +428,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add option="-DCC_NO_COLLAPSE_ITEM" />
  <Add directory="include" />
  <Add directory="include/mozilla_chardet" />
@@ -448,7 +469,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add directory="include" />
  </Compiler>
  <Linker>
@@ -479,7 +503,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add directory="include" />
  </Compiler>
  <Linker>
@@ -510,7 +537,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add directory="include" />
  </Compiler>
  <Linker>
@@ -541,7 +571,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add directory="include" />
  </Compiler>
  <Linker>
@@ -572,7 +605,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add directory="include" />
  <Add directory="include/mozilla_chardet" />
  <Add directory="include/mozilla_chardet/mfbt" />
@@ -609,7 +645,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add directory="include" />
  <Add directory="include/scripting/include" />
  <Add directory="include/scripting/sqplus" />
@@ -642,7 +681,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add directory="include" />
  <Add directory="include/mozilla_chardet" />
  <Add directory="include/mozilla_chardet/mfbt" />
@@ -679,7 +721,10 @@
  <Option run_host_application_in_terminal="0" />
  <Option projectLinkerOptionsRelation="1" />
  <Compiler>
- <Add option="-DBUILDING_PLUGIN" />
+ <Add option='-include &quot;sdk_precomp.h&quot;' />
+ <Add option="-DEXPORT_LIB" />
+ <Add option="-DEXPORT_EVENTS" />
+ <Add option="-DWXMAKINGDLL_SCI" />
  <Add directory="include" />
  </Compiler>
  <Linker>
@@ -700,7 +745,7 @@
  </Target>
  <Environment>
  <Variable name="WX_CFG" value="" />
- <Variable name="WX_SUFFIX" value="u" />
+ <Variable name="WX_SUFFIX" value="ud" />
  <Variable name="WX_VERSION" value="30" />
  </Environment>
  </Build>
@@ -716,11 +761,14 @@
  <Add option="-mthreads" />
  <Add option="-fmessage-length=0" />
  <Add option="-fexceptions" />
+ <Add option="-Winvalid-pch" />
+ <Add option="-Wno-deprecated-declarations" />
  <Add option="-DHAVE_W32API_H" />
  <Add option="-D__WXMSW__" />
  <Add option="-DWXUSINGDLL" />
  <Add option="-DcbDEBUG" />
- <Add option="-DNOPCH" />
+ <Add option="-DCB_PRECOMP" />
+ <Add option="-DWX_PRECOMP" />
  <Add option="-DwxUSE_UNICODE" />
  <Add directory="$(#WX30.include)" />
  <Add directory="$(#WX30.lib)/gcc_dll$(WX_CFG)/msw$(WX_SUFFIX)" />
@@ -1272,6 +1320,7 @@
  <Option target="sdk" />
  </Unit>
  <Unit filename="include/sdk_precomp.h">
+ <Option compile="1" />
  <Option weight="0" />
  <Option target="sdk" />
  </Unit>
diff --git a/src/include/sdk.h b/src/include/sdk.h
index 46361c7..bfff9f6 100644
--- a/src/include/sdk.h
+++ b/src/include/sdk.h
@@ -10,11 +10,11 @@
 #ifndef SDK_H
 #define SDK_H
 
-#ifdef __WXMSW__
- #include "sdk_common.h"
-#else
+//#ifdef __WXMSW__
+// #include "sdk_common.h"
+//#else
  // for non-windows platforms, one PCH is enough
  #include "sdk_precomp.h"
-#endif
+//#endif
 
 #endif // SDK_H


--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version