Author Topic: changing codeblocks compiler  (Read 13153 times)

supagu64

  • Guest
changing codeblocks compiler
« on: December 11, 2005, 04:36:41 am »
right, i've installed visual studio 2003 toolkit, and then installed cde blocks IDE only. When it loads for the first time it detects the vc toolkit, which i then set as the default compiler. i make a new sample project, try to compile it and it seems it wants to use gcc:

Code
Project   : Console application
Compiler  : GNU GCC Compiler (called directly)
Directory : D:\Programming\test5\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: main.cpp
Execution of 'mingw32-g++.exe       -c main.cpp -o .objs\main.o' in 'D:\Programming\test5' failed.

any idea how to get it to use vc2003 toolikit correctly?

supagu64

  • Guest
Re: changing codeblocks compiler
« Reply #1 on: December 11, 2005, 04:48:54 am »
problem solved. You have to change it in the build options for each project :|

takeshimiya

  • Guest
Re: changing codeblocks compiler
« Reply #2 on: December 11, 2005, 05:41:06 am »
The problem is that the templates are created for GCC. You must make your changes (ie. use MSVC compiler setting) and create your own template (menu Project->Save project as user-template).

This is a known limitation of the templates system and will be addresed in compiler plugin revamping post-1.0 .

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: changing codeblocks compiler
« Reply #3 on: December 11, 2005, 05:50:31 am »
Is this the same guy I just helped with this on GDNet?  :?
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: changing codeblocks compiler
« Reply #4 on: December 11, 2005, 08:07:15 pm »
The problem is that the templates are created for GCC. You must make your changes (ie. use MSVC compiler setting) and create your own template (menu Project->Save project as user-template).

This is a known limitation of the templates system and will be addresed in compiler plugin revamping post-1.0 .
There was sometime ago a discussion about project templates and compilers (see http://forums.codeblocks.org/index.php?topic=1183.0). Is the compiler plugin revamping post-1.0 the proposed solution for this "problem"?

Thank you very much.

Michael

takeshimiya

  • Guest
Re: changing codeblocks compiler
« Reply #5 on: December 12, 2005, 11:15:13 am »
Well, it's one of the solutions, because you'll have in only one template, all the compilers supported.

But a current solution (workaround) would be to have one template for each compiler supported by C::B. And then when you open the New Project dialog, the dialog would always choose the template according to the default compiler.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: changing codeblocks compiler
« Reply #6 on: December 12, 2005, 11:35:01 am »
Well, it's one of the solutions, because you'll have in only one template, all the compilers supported.
IMHO, this would be a rather good solution. May be it would be possible to simplify the template, by asking the user for information (to make it somehow interactive).

But a current solution (workaround) would be to have one template for each compiler supported by C::B. And then when you open the New Project dialog, the dialog would always choose the template according to the default compiler.
Yes, I think that at the beginning this could be a solution. But several templates to manage could become a problem (especially when their number will increase).

Michael
 

takeshimiya

  • Guest
Re: changing codeblocks compiler
« Reply #7 on: December 12, 2005, 11:46:23 am »
Yes, I think that at the beginning this could be a solution. But several templates to manage could become a problem (especially when their number will increase).

Well, not a problem, but rather the person who creates the template, will need to create and test each template with every compiler.

Which in fact, it is necessary because of the C::B nature of supporting more than 1 compiler.
Also remember that some libraries/templates will never be supported on every compiler, so the templates will not be available for all compilers sometimes.

So suppose the case when a person creates a template, he may create a Mingw32 and a MSVC version.
And then when a user tries to use that template, C::B will choose Mingw32 or MSVC according to the default compiler.
And in the case of the user is using another compiler (not supported by that template), a messagebox will appears saying that the template only supports the following compilers: Mingw32, MSVC.

Or, it could be moved right to the New Project dialog, so the user doesn't even see the templates don't supported for the default compiler.

What do you think?

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: changing codeblocks compiler
« Reply #8 on: December 12, 2005, 12:03:54 pm »
Yes, I think that at the beginning this could be a solution. But several templates to manage could become a problem (especially when their number will increase).

Well, not a problem, but rather the person who creates the template, will need to create and test each template with every compiler.

Which in fact, it is necessary because of the C::B nature of supporting more than 1 compiler.
Also remember that some libraries/templates will never be supported on every compiler, so the templates will not be available for all compilers sometimes.
Yes, you're right. But I think that it would be easier to have just a template containing all the info (e.g., supported compilers) rather than e.g., templateX_MSVC, templateX_minGW, templateX_SDCC. The problem here would be to correctly manage the templates. For example, if you modify the templateX structure, then you will have to do it for all the templateX (and it can be that you will forget one...).

So suppose the case when a person creates a template, he may create a Mingw32 and a MSVC version.
And then when a user tries to use that template, C::B will choose Mingw32 or MSVC according to the default compiler.
And in the case of the user is using another compiler (not supported by that template), a messagebox will appears saying that the template only supports the following compilers: Mingw32, MSVC.

Or, it could be moved right to the New Project dialog, so the user doesn't even see the templates don't supported for the default compiler.

What do you think?
IMHO, I would prefer the first proposition. I would prefer to see all the templates. If I chose one not supported a message box should let me know this, but also allow me to use it anyway (at my own risk :)). This for trying to make it works or for tesing it or studying it.

On the other side the second proposition would be most suitable for beginners or users preferring a simple, clear and easy interface. This would also avoid most of the posts like "This template does not work with compiler X".

May be the choice between the two alternatives could be let to the user (in the Settings menu). 

Michael

takeshimiya

  • Guest
Re: changing codeblocks compiler
« Reply #9 on: December 12, 2005, 12:28:03 pm »
Another option is to have in New from template dialog a Compiler option, just below Category.
And showing the templates according to each compiler, of course defaulting to the default compiler.

I think that is the most transparent to the user.
« Last Edit: December 12, 2005, 12:29:54 pm by Takeshi Miya »

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: changing codeblocks compiler
« Reply #10 on: December 12, 2005, 12:31:47 pm »
Another option is to have in New from template dialog a Compiler option, just below Category.
And showing the templates according to each compiler.
But if I want to chose a template not supported for the selected compiler?

Michael

takeshimiya

  • Guest
Re: changing codeblocks compiler
« Reply #11 on: December 12, 2005, 01:12:00 pm »
You'll choose the compiler that you think it's most simmilar.

eg. you want a OpenWatcom QT project.
You think GCC is perhaps simmilar to OpenWatcom (rather than MSVC).

Then you choose the GCC QT template, and in the template, you change the according things to make it work on OpenWatcom.
You save the project as a template, and if you want, submit it to SF tracker so others can use it.


That is more or less what you'll do anyways with the other option (having a messagebox telling its not supported...).
Only that now you'll have the option to choose the most simmilar compiler template (or whatever you want).

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: changing codeblocks compiler
« Reply #12 on: December 12, 2005, 01:23:40 pm »
You'll choose the compiler that you think it's most simmilar.

eg. you want a OpenWatcom QT project.
You think GCC is perhaps simmilar to OpenWatcom (rather than MSVC).

Then you choose the GCC QT template, and in the template, you change the according things to make it work on OpenWatcom.
You save the project as a template, and if you want, submit it to SF tracker so others can use it.


That is more or less what you'll do anyways with the other option (having a messagebox telling its not supported...).
Only that now you'll have the option to choose the most simmilar compiler template (or whatever you want).
It could be a solution. But IMHO it would be good to make this as a selectable option for "advanced user". For "normal user" it would be better to propose templates filtered by supported compilers. If then a user would like to use a not supported template, she/he could activate the option and then chose the most similar compiler template.

Michael

takeshimiya

  • Guest
Re: changing codeblocks compiler
« Reply #13 on: December 12, 2005, 01:53:43 pm »
I don't know, that could make more hassle than it solves.
How advanced for a user is selecting a compiler?

Apart from that, you could see it clearly what templates support what compiler and such.

Making a selection of a compiler in New from template solves things like:
wxWidgets template makes sense for GCC, MSVC, DMars, etc.
But for SDCC only makes sense C templates (SDL, Hello World).

And also, the users have the option to choose the compiler in: Compiler Settings, and Project Settings.
It makes the logical thing, having a option to select the compiler from New from template dialog.
« Last Edit: December 12, 2005, 01:56:03 pm by Takeshi Miya »

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: changing codeblocks compiler
« Reply #14 on: December 12, 2005, 02:00:18 pm »
It might be a good idea to put the option to hide incompatible templates in the dialog itself though, so you don't have to close it, go to the settings, enable the option, and go back to the dialog.
Either a checkbox "Only show templates that support $DEFAULT_COMPILER / the default compiler", or a "Settings..." button (if there are more settings for the dialog).
If the option to select a compiler is added to the dialog as Takeshi Miya suggested, the checkbox text can be shortened to "Only show compatible templates" or some such.