views:

78

answers:

2

g++ compiler complains about conversions between related types (from int to enum, from void* to class*, from const char* to unsigned char*, etc.). Compiler handles such convertions as errors and won't compile furthermore. It occurs only when I compile using Dev-C++ IDE, but when I compile the same code (using the compiler which Dev-C++ uses) such errors (even warnings) do not appears. How to mute errors of such types?

+2  A: 

I suspect that in one case you are compiling your code as C and the other as C++. In C++, there is no implicit conversion from void * to any other type of pointer, and a C++ compiler which did not diagnose this as an error would be broken. You need to supply more details of how you are compiling your code.

Also, DevC++ is a pretty awful piece of code. It's buggy and no longer being actively developed, as well as being butt-ugly. You should seriously consider switching to a more modern and capable IDE, such as Code::Blocks.

anon
Yes, that's right - problem was in g++ compiler - I compiled the same code using gcc compiler and it worked fine. Thanks!
Slav
@Slav, please, be more correct: the problem was not in the compiler, but in *your incorrect choice* of compiler.
Pavel Shved
@Pavel If we are going to start correcting English usage in comments, it's going to be a long night.
anon
@Neil, I don't like when people blame tools for their own faults, that's all. (But if it is just incorrect use of English, I'm taking back what I said.)
Pavel Shved
Of course! I was must to write "problem was in CHOOSING g++ compiler" - sorry for that.
Slav
I think it's need to keep questions and answers up to language rules and especially programming semantic - it will be helpful in learning both language and programming.
Slav
@Slav, good point. By the way, StackOverflow has a notification system (see how that envelope at the top turns yellow?), here's some tips on how to use it: http://meta.stackoverflow.com/questions/43019/how-do-comment-replies-work
Pavel Shved
A: 

All of your implicit conversions are disallowed in standards conforming C++. G++ is simply enforcing these rules.

Yann Ramin