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

How can I biuld codeblocks with codeblocks on linux

<< < (5/8) > >>

Jenna:
It worked (and works) without turning precompiled headers off with gcc < 4.3.

Since 4.3 there seem to be problems with line numbers in some cases.
I found just one post about this issue, but without a solution: http://gcc.gnu.org/ml/gcc-help/2008-10/msg00209.html.

For me it only works (with gcc >= 4.3), if I totally turn off precompiled-headers. NOPCH or not using CB_PRECOMP or WX_PRECOMP is not enough.

The only way to totally turn off precompiled headers is in the "Advanced" section of the compiler settings, but that works globally for all projects and is not what I expect.
I use a copy of my gcc for that purpose.

In the project's properties, I am only able to chose the place where the pch is created, but not if it is created or not.
Or do I miss something?

I think a simple checkbox ("Use precompiled headers"), that is checked by default would make sense (in the properties).

What does the other devs think about it ?

bruin:
Jens nailed the problem. It works for me if I turn off precompiled headers in settings/compiler/other settings/advanced.

Also, you have to rebuild the whole project. If you rebuild only the target you want to debug, it will still have bad line numbers in the debug info.

MortenMacFly:

--- Quote from: jens on June 30, 2009, 07:13:58 pm ---What does the other devs think about it ?

--- End quote ---
In fact this was (and is) a bit confusing for me, too. Hence I can disable PCH if I do the steps as I described somewhere else in this forum.
But a checkbox might really be more convenient.

In addition I have modified the code in compilerMINGWgenerator.cpp like this:

--- Code: ---Index: src/plugins/compilergcc/compilerMINGWgenerator.cpp
===================================================================
--- src/plugins/compilergcc/compilerMINGWgenerator.cpp (revision 5680)
+++ src/plugins/compilergcc/compilerMINGWgenerator.cpp (working copy)
@@ -35,8 +35,9 @@
 {
     wxString result = CompilerCommandGenerator::SetupIncludeDirs(compiler, target);
     m_VerStr = compiler->GetVersionString();
-    wxString pch_prepend;
+    wxString pch_prepend = wxEmptyString;
     bool IsGcc4 = m_VerStr.Left(1).IsSameAs(_T("4"));
+    bool HasPCH = false; // We don't know yet if there are any header files to be compiled...
 
     // for PCH to work, the very first include dir *must* be the object output dir
     // *only* if PCH is generated in the object output dir
@@ -64,6 +65,7 @@
                     else
                         pch_prepend << _T("-iquote") << dir << _T(' ');
                 }
+                HasPCH = true; // there is at least one header file to be compiled
             }
         }
         // for gcc-4.0+, use the following:
@@ -78,9 +80,11 @@
             pch_prepend << compiler->GetSwitches().includeDirs << includedDirs[i] << _T(' ');
         }
         pch_prepend << _T("-I. ");
-        result.Prepend(pch_prepend);
     }
 
     // add in array
+    if (HasPCH)
+        result.Prepend(pch_prepend);
+
     return result;
 }

--- End code ---
(Not exactly related to that topic but turns off the annoying warnings if there are no PCH files.)

Jenna:
It's much simpler as I thought:

just right-click sdk_precomp.h in the project tree, click properties, chose tab Build and uncheck Compile file.
And I think you should manually remove sdk_precom.h.gch and rebuild the whole project.

That's it.

MortenMacFly:

--- Quote from: jens on July 01, 2009, 03:25:20 pm ---just right-click sdk_precomp.h in the project tree, click properties, chose tab Build and uncheck Compile file.

--- End quote ---
This is exactly what happens if you setup the specific #defines accordingly. -> Inspect the header file, it's basically "empty" even if you compile it by then.


--- Quote from: jens on July 01, 2009, 03:25:20 pm ---And I think you should manually remove sdk_precom.h.gch and rebuild the whole project.

--- End quote ---
Probably that was the real problem here...?!

IMHO GCC always uses the GCH file if present (and can be found due to include folders). But I might be wrong...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version