Code::Blocks Forums
User forums => Help => Topic started by: roussec on October 26, 2005, 10:59:19 am
-
Hi,
when I install RC2 it recognizes that VC Toolkit 2003 is installed and I press Set as default and on Ok. After creating a project and trying to compile I get the error'Can't find compiler executable in your search path for GNU GCC Compiler'. The default compiler is VC Toolkit 2003 but I have to manually go to Project->Properties->Target->Target's build options... and change the compiler from GNU GCC to VC Toolkit 2003. Is there a reason the default compiler is not used for new projects?
Christian
-
Can anyone else confirm this?
-
Hello,
I have the same problem (or quite). I have installed CB RC2 and when starting it the default compiler was VC Toolkit 2003. Then I have created a new console project by using the template, but when compiling I have remarked that CB was using:
GNU GCC Compiler (called directly)
In the project properties, the compiler selected and default is the GNU GCC, but under Settings, the selected and default compiler is the VC Toolkit 2003.
Strange. Is this a possible bug?
Despite this "bug" (?), CB RC2 seems to work better that the previous version (but I am using it since 20 minutes). For example by loading several projects of a workspace. The only thing that requires a bit of patient is when you close more than one project to wait until CB has saved the code completion cache of each project.
Best wishes,
Michael
PS.: I have both compilers installed in my computer
-
Try creating a new project but without templates. What compiler is listed as the project's default?
-
Hallo,
I have tried to create an empty project without using the template and now the compiler used is the VC Toolkit 2003. But, I have to say that I have changed manually the compiler for the previous project (template generated one). Consequently, I have re-created another project by using the template and the compiler used was again the GNU GCC. In the project build options the selected and default compiler was the GNU GCC.
May be the problem is with the template used for the new project generation.
Best wishes,
Michael
-
Yes, that was my assumption. But please create new project from scratch using the "Project" menu, and save it. Which compiler is listed in the project's options?
-
Hello,
In the project's Build Options, in the "Selected compiler" box, the GNU GCC Compiler is chosen. Anyway, I can change it to any other compiler, even if I do not have it installed, e.g., SDCC, Borland C++ Compiler 5.5.
Moreever, the new project option, just create a default configuration and not a debug and release one (as in Visual Studio). But I am not sure that this is an error.
Best wishes,
Michael
-
Yes, that was my assumption. But please create new project from scratch using the "Project" menu, and save it. Which compiler is listed in the project's options?
If I do that the default compiler is used for the project.
-
Hello,
Not really.
If I create a "new project", the selected compiler is GNU GCC which is not the default compiler.
If I create a "new empty project", then the selected compiler is the default compiler (i.e., VC Toolkit 2003).
Best wishes,
Michael
-
Please, don't waste your time on this bug. I know exactly what causes it and it 'll be fixed.
-
Alright! Thanks Yiannis! :) I guess I'll add it to the "current issues". Please tell us when it's fixed, anyway.
-
Alright! Thanks Yiannis! :) I guess I'll add it to the "current issues". Please tell us when it's fixed, anyway.
I might as well state the problem here.
The problem has to do with templates (obviously :P). There's a piece of code in C::B that, when a project is created from a template, sets the default compiler to be the new project's compiler. This piece of code is commented-out for RC2 (and quite some time for CVS).
So, this is the reason for the behaviour stated in this topic.
Now, you may ask why I did that.
Well, the current template format is a little restrictive for this matter.
Some templates (like console app, win app, dll, etc), have nothing compiler-specific in their options. For them, the compiler could be set on project creation.
Some other templates though (like wxWidgets, Ogre, Irrlicht) have different configs for different compilers. This can be seen in the "Project options" field of the "New project" wizard, as they have different entries for GCC and MSVC (under windows anyway). For these templates it would be bad to set the compiler after creation.
Say you have GCC as default compiler. And you create a new Ogre project for MSVC (which you have installed). Now, how nice it would be if you pressed "Build" and a whole lot of errors appeared and after searching around you discovered that the compiler was (automatically) set to GCC? You would bitch against Code::Blocks and that would be fair enough ;)
See the dilema?
Maybe a flag in the template specification allowing (automatic) compiler change after project creation, would do the trick?
Your views on the subject please...
-
Say you have GCC as default compiler. And you create a new Ogre project for MSVC (which you have installed). Now, how nice it would be if you pressed "Build" and a whole lot of errors appeared and after searching around you discovered that the compiler was (automatically) set to GCC? You would bitch against Code::Blocks and that would be fair enough ;)
If you leave it the way it is people will also bitch against Code::Blocks since it behaves as you describe it -> Code::Blocks chooses the wrong compiler and can't compile. Since I am not really into the templates and how they communicate with the program I do not know if this is possible. But why not use the default compiler by default and let the templates switch compilers for th eproject if they rely on a different compliler (and generate a warning that a necessary compiler is not installed if it is not installed)
Christian
-
I think a quick "hack" (or fix? ;-) ) would be to specify whether the Template is compiler-specific or not. If it's compiler-specific, have the template specify a particular compiler.
On creating new project from template, if the template is compiler specific, check if the default compiler is the same than the template's.
Here we have 3 cases:
a) Default compiler is template's compiler. Don't ask anything.
b) Default compiler is not template's compiler, but template's compiler is installed. Issue a minor warning. "Note: This project is GCC-specific, so it'll be compiled with GCC instead of (default compiler)". (OK)
c) Default compiler is not template's compiler, AND template's compiler is NOT installed. Issue warning and ask for option. "Warning: This project is GCC-specific, but you don't have GCC installed. Do you wish to set the new project to use (Default compiler), and fix the compiler errors by yourself?"
In any case, add to the template, the compiler used. "OGRE template (for use with GCC compiler)".
(Now I realize the need to specify diff. options for diff. compilers in a project :P - I'm glad version 1.0 is not far from now :) )
-
What about a meta-template format that includes inside different templates for different compilers?
-
What about a meta-template format that includes inside different templates for different compilers?
But this is already supported. Just *try* to create a new Ogre project. You 'll see you have the option to create a GCC or MSVC one. That's why I commented-out the code in C::B that set the compiler. The template can set it alone.
BUT not all templates are like that, hence the problem. For simple templates it seems that C::B has this bug.
And I can understand people when thinking that a new project would be created for their default compiler. It's just that more complex projects need different options based on the compiler...
I 'm afraid this issue won't be resolved in a satisfactory way, until the compiler framework is redesigned (post-1.0).
-
But I'm talking about a template that haves BOTH GCC and MSVC options, and depending on what the default compiler is, use the respecting options.
Think of it as 2 different templates inside 1.
Or I'm missing something?
EDIT: Anyways, it's better to wait for post-1.0 to resolve this at a compiler-plugin level rather than at a template level.
-
I see... what a pity. But I still don't like it, if all it takes to solve this problem is to add a couple more templates, why not doing it?
There are TONS of MSVC users out there, why bother them with unnecessary annoyances?
If the default behavior causes problems, then it shouldn't be the default behavior at all, right?
-
Maybe a flag in the template specification allowing (automatic) compiler change after project creation, would do the trick?
I think a quick "hack" (or fix? Wink ) would be to specify whether the Template is compiler-specific or not. If it's compiler-specific, have the template specify a particular compiler.
We 're saying the same thing here. I believe it's the only logical solution for now...
-
Alright! It's settled then. :)