User forums > Using Code::Blocks

Compiler Q's

(1/2) > >>

vserghi:
I have just had a quick look at another free IDE called Pelles C (http://www.smorgasbordet.com/pellesc/index.htm), It had a couple of interesting errors that came up whilst trying to compile an existing project. Two things;

1. It told me "Missing prototype for 'printf". Being a complete newbie, I had obviously not included the correct header file. Easy to fix.

2. It managed to tell me that some variables that I had defined were not being referenced. Again easy to fix.

How did C::B (and DevCpp) compile my program with these errors present? How did my program work ok with these errors present (using just plain ol' C)? Is there an option that I can set for me to check for these type of errors? (it uses LCC as its compiler)

As an aside, it had a nice resource editorĀ  :). You can add icons, cursors, menu/table entries, version numbers, manifest info, dialogue info.

Vasilis.

tiwag:

--- Quote from: vserghi on August 04, 2005, 01:47:11 pm ---I have just had a quick look at another free IDE called Pelles C (http://www.smorgasbordet.com/pellesc/index.htm), It had a couple of interesting errors that came up whilst trying to compile an existing project. Two things;

1. It told me "Missing prototype for 'printf". Being a complete newbie, I had obviously not included the correct header file. Easy to fix.

2. It managed to tell me that some variables that I had defined were not being referenced. Again easy to fix.

How did C::B (and DevCpp) compile my program with these errors present?

--- End quote ---

different compilers behave different, that's what we have to live with -
- sometimes it's difficult to differentiate between erros and warnings...


--- Quote from: vserghi on August 04, 2005, 01:47:11 pm --- How did my program work ok with these errors present (using just plain ol' C)? Is there an option that I can set for me to check for these type of errors?

--- End quote ---

what you describe can also let be warned by gcc, when you use the compiler switch "-Wall"
or in codeblocks set "Enable all compiler warnings" in Project->Build options->Compiler Flags


about PellesC
--- Quote from: vserghi on August 04, 2005, 01:47:11 pm ---(it uses LCC as its compiler)
As an aside, it had a nice resource editorĀ  :). You can add icons, cursors, menu/table entries, version numbers, manifest info, dialogue info.

--- End quote ---

PellesC is really a very nice piece of SW and very very well thought out and usable.
But limited to C - well for most things but not for all.
And it doesn't use LCC as its compiler, Pelles C-compiler is based on LCC, but it's completely overworked now and targets only Win32.

I have done a lot of small projects with PellesC and i use it regularly when i need some quick tools - mostly console applications.
The IDE with included resource editor and debugger is really delicate - for small projects.

vserghi:
Thanks for that. I will try the "Enable all compiler warnings" option in the compiler and see what I get.

As I have only ever done simple console type programs, I will probably use Pelles C and C::B for my debugging and Pelles C for my resource editing.

I've just tried the option and it did throw up those errors after I put them back in again, nice. Unfortunately it also threw up some more errors. At least I will learn a few things in trying to fix them.

Ta, Vasilis.

kagerato:

--- Quote from: vserghi on August 04, 2005, 02:22:04 pm ---Unfortunately it also threw up some more errors. At least I will learn a few things in trying to fix them.
--- End quote ---

Warnings and errors tend to cascade with C/C++.  One problem will lead to an error in parsing, but the compiler continues onward and marks additional "errors" that are also the result of the same original problem.

A single missing character can sometimes get you a page-full of "problems".

thomas:

--- Quote from: vserghi on August 04, 2005, 01:47:11 pm ---1. It told me "Missing prototype for 'printf"  [...]

2. It managed to tell me that some variables that I had defined were not being referenced.

How did C::B (and DevCpp) compile my program with these errors present? How did my program work ok with these errors present (using just plain ol' C)?
--- End quote ---

1. gcc has a large number of "builtin functions". Among these are many standard math functions, and, too, printf() : http://gcc.gnu.org/onlinedocs/gcc-3.4.4/gcc/Other-Builtins.html#Other-Builtins
The good thing about builtins is that some of them (math functions, memcpy, vector funcs etc.) can be optimized to one CPU instruction under optimal circumstances instead of a quite expensive library call. The bad thing is, as you did experience, it will compile certain examples just fine, while other compilers will choke on it. That is not helpful in writing portable programs, admitted.

2. This is not an error. It is not good, but it is not an error. If you call gcc with warnings enabled, it will tell you, but either way, this is nothing that prevents your program from running.

Navigation

[0] Message Index

[#] Next page

Go to full version