Author Topic: bugs and a compiler problem  (Read 8230 times)

Eric Burnett

  • Guest
bugs and a compiler problem
« on: February 17, 2005, 07:37:12 am »
Hey, great IDE you've got here. I was using Dev-C++, and someone reccomended this one. I'm likin' it so far! Especially switching between compilers. Which, oddly enough, is where my problem comes in.

When I make a new, empty project (or any other type I think), and go to compile, I get "Command execution failed...". When I go to Settings > Configure Plugins > Compiler, I can see it is set how I want it to be. But when I right click on the project and hit "Build options", I find it is way different. For one, Console Application and default have different compilers, which is causing that problem. And neither has the options I set for the plugin :roll:. I figure either I don't understand at all what is happening, or there is a bug. At the moment it is no biggie, I know how to get around it, but it means I have to setup the compiler anew every time I make a project, and redo the options to boot. It is a bizzare error, because for things like the 'other' options (like compiler logging style), it accepts what the plugin is set for.

Also, in that same build options area, if I check some compiler options and then switch compilers, they are put into the "More options" area instead of just removed. I have to clear that manually or it causes a compiler error.

And the auto-indent seems to be functioning oddly...it keeps the indent from the previous line, but when I make a brace or anything, it does not tab in when I hit enter. Shouldn't it?

Thats all I've got for the moment, but I'll be sure to let you know if I find any more. Thanks for the good prog, and keep up the good work!

BTW, I am using VC++ Toolkit 2003 as default (trying to ;)), on Windows XP Pro. Beta 5 at the moment.

Eric Burnett

  • Guest
bugs and a compiler problem
« Reply #1 on: February 17, 2005, 08:06:48 am »
Oh, and one other thing. If you try to debug when there isn't a debugger setup, it thinks it is debugging, and you can't tell it to stop. This means you have to close the program to try again. Not really a big deal since I don't have a debugger ;), but may as well mention it.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
bugs and a compiler problem
« Reply #2 on: February 17, 2005, 09:33:20 am »
The multiple-compiler-setup feature is not designed to let you switch compiler on-the-fly for your project and adjust all your settings accordingly. There 's a good reason for this behaviour. The compiler plugin is pretty configurable. It even let's you configure an unsupported compiler (even more so in the next release). It couldn't possibly know all the compiler options of every existing compiler so to switch between them and substitute their options accordingly!
The only solution to this problem would be to allow different settings for different compilers for each project. This might get implemented in the future, but no automatic option conversion. That is just not possible...

You can work around it, though. Create different targets per-compiler in your project.
Or create different projects per-compiler (that's the approach I usually take). Since the workspace allows for multiple open projects, I see no downside to this ;)

Quote
When I make a new, empty project (or any other type I think), and go to compile, I get "Command execution failed...".

Although you seem to understand the problem here, let me give you a hint which will benefit others who read this post. When you see a "Command execution failed..." message in the compiler log, switch to the "Code::Blocks Debug" log. There you can see the exact command that failed. This might give you a clue. Usually, though, this happens when an unconfigured or badly configured compiler is used.

Quote
For one, Console Application and default have different compilers, which is causing that problem.

I dont't really understand this, but I guess you are talking for the default compiler settings when you create a new project from a template.
The supplied templates contain settings for the GCC compiler only. They 're being updated now and the next release should behave correctly for this matter.
As a workaround (gee! codeblocks has got workarounds for everything! ;) ) after you configure your new project for the compiler you 're using, click on "Project/Save project as user-template". This will save your project as a template. Next time you 'll want to start a similar project, when you click on "Project/New", switch to the "User-templates" tab and select your project.

Quote
Also, in that same build options area, if I check some compiler options and then switch compilers, they are put into the "More options" area instead of just removed. I have to clear that manually or it causes a compiler error.

As said before, that is automatic option conversion between different compilers. Not supported as explained...

Quote
And the auto-indent seems to be functioning oddly...it keeps the indent from the previous line, but when I make a brace or anything, it does not tab in when I hit enter. Shouldn't it?

No, it is designed that way. There are far too many different coding styles to support and make everybody happy. And because I 've seen flame wars for exactly this topic, basic indentation support is provided only. At least for now ;)

Cheers,
Yiannis.
Be patient!
This bug will be fixed soon...

Offline mike

  • Multiple posting newcomer
  • *
  • Posts: 53
bugs and a compiler problem
« Reply #3 on: February 17, 2005, 12:43:09 pm »
Quote
but no automatic option conversion


Of course, it is possible - one just needs to define the interface for Compiler plugins to say: "This option = this flag" and "Only-this-compiler-opiont = this flag". Non-trivial, I guess, but possible :-)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
bugs and a compiler problem
« Reply #4 on: February 17, 2005, 01:36:23 pm »
But not all compilers support the same options...
Except for the basic ones (debugging info, optimization, some C++ features) there are huge differences.

What do you prefer? Full or crippled support for a feature???
That's what I mean by saying "it's not possible". Full support is not possible. Crippled support is never good. Hidden bugs, people not understanding why it works for some things and not for others, etc...

Yiannis.
Be patient!
This bug will be fixed soon...

Eric Burnett

  • Guest
bugs and a compiler problem
« Reply #5 on: February 17, 2005, 05:10:49 pm »
Thanks for the prompt reply! You have cleared almost everything up, I'm just confused on one issue. When are the compiler options that are setup in the plugin ever used? Because when I make a new, empty, project (so not from a template) right from the start it uses something else for the compiler options. I am not actually trying to switch on the fly, it just works out this way ;).

My Global compiler options:


And my Project's Compiler Options:


The default tab:


Oh, and the last item in the Code::Blocks log (if I am looking at the right thing) says "MacrosManager initialized". Nothing about compiling.

Thanks for the great work!

Anonymous

  • Guest
bugs and a compiler problem
« Reply #6 on: February 18, 2005, 03:38:20 am »
Just found out what you meant about the debug log. For some reason, the last line is

[18:23:53.828]: Execution of 'mingw32-g++.exe   -Os -O    -I"C:\\Dev-Cpp\\include" -I"C:\\Dev-Cpp\\include\\c++" -I"C:\\Dev-Cpp\\include\\c++\\3.4.2" -I"C:\\DX9SDK\\Include" -I"C:\\DX9SDK\\Samples\\C++\\Common" -I"C:\\Dev-Cpp\\include\\c++\\3.4.2\\mingw32"  -c "test.cpp" -o ".objs\\test.obj"' in 'C:\Documents and Settings\Eric Burnett\Desktop' failed.

even though on the compiler tab it says

Compiler  : Microsoft Visual C++ Toolkit 2003 (called directly)
Directory : C:\Documents and Settings\Eric Burnett\Desktop\

This is all related to it defaulting the compiler oddly, I'm just not sure why it is doing this.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
bugs and a compiler problem
« Reply #7 on: February 18, 2005, 09:14:42 am »
The problem comes from the "default" target's selected compiler (based on your screenshots). You have GCC selected there.

When you hit compile, you are not compiling your project(!), but instead you 're compiling the project's targets. By default, the virtual target "all" is selected which causes all project's targets to be built (except those not belonging to the "all" target). In other words, a project is a collection of build targets.
When you switch compiler in the project's build options (and the project is selected in the tree - your 2nd screenshot), codeblocks should ask you if you want to change the compiler for all the targets accordingly. If it didn't, we may have a bug there.

Anyway, just change the compiler for the "default" target and you 're all set.

Yiannis.
Be patient!
This bug will be fixed soon...

Anonymous

  • Guest
bugs and a compiler problem
« Reply #8 on: February 18, 2005, 05:15:21 pm »
Yeah, I caught that, the real problem in my eyes is twofold. 1) By default, it is generating two different compilers for a blank project (I didn't change anything, just opened for a look and took screenshots), because it looks like 'Untitled1' is getting it from the plugin options, but 'default' is always starting with GCC. And 2), the global compiler options don't seem to appear on the project compiler options page. I'm not sure if it is compiling with those options anyways (I doubt it), or if they are just not being grabbed.

Either way, were pretty good here. Thanks for the prompt answers.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
bugs and a compiler problem
« Reply #9 on: February 18, 2005, 08:17:39 pm »
Quote
By default, it is generating two different compilers for a blank project

This was fixed today in CVS :)

Quote
the global compiler options don't seem to appear on the project compiler options

They 're not supposed to. Global compiler options are always in effect. That's why they 're called "global" ;)

Thank you for your comments,
Yiannis.
Be patient!
This bug will be fixed soon...

Anonymous

  • Guest
bugs and a compiler problem
« Reply #10 on: February 18, 2005, 11:32:58 pm »
Ahh, that explains that then! Thanks for the effort you put into this...its an amazing project.

Offline mike

  • Multiple posting newcomer
  • *
  • Posts: 53
bugs and a compiler problem
« Reply #11 on: February 19, 2005, 08:48:12 am »
Another thing related to multiple compilers: one I add a source file, I am asked which target it shall belong to, and I can only choose one target?

Anonymous

  • Guest
bugs and a compiler problem
« Reply #12 on: February 19, 2005, 07:07:38 pm »
As in my second screenshot, when you start there are build options for the entire scope (my Untitled1 workspace), as well as one target, default. If you wish to have multiple targets to choose from for when you add a source file, you need to add another target from the project properties area. Although why you are getting the option when you only have one target is beyond me....

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
bugs and a compiler problem
« Reply #13 on: February 24, 2005, 09:03:57 am »
Quote from: mike
Another thing related to multiple compilers: one I add a source file, I am asked which target it shall belong to, and I can only choose one target?

This has been fixed in CVS and asks for multiple targets.

Yiannis.
Be patient!
This bug will be fixed soon...

Offline mike

  • Multiple posting newcomer
  • *
  • Posts: 53
bugs and a compiler problem
« Reply #14 on: February 24, 2005, 02:17:56 pm »
Quote
This has been fixed in CVS and asks for multiple targets.


Thanx!
Unfortunatelly, I don't really want to mess up with wxWidgets to compile the CVS sources, so I'll wait for the binary :-)