Quote Originally Posted by Zlatomir View Post
@koder: Qt SDK does not install g++ for you (except the Windows one which comes with MingW) on other platforms you need to install g++ and make.
Right, but on most other systems, gcc/g++ is already available. What I meant to say was: Even the compiler tool chain is taken care of automatically.

Quote Originally Posted by Zlatomir View Post
NOTE: C++ compilers have the C header files from C standard library, but there are without .h extension and have 'c' prefix: like in place of "#include <stdio.h>" you will write "#include <cstdio>" and so on...
Yes. But be careful. They are not always exactly the same as there C counterparts. And you'd need to put "std::" in front of the functions. So you either use <stdio.h> and printf *OR* you use <cstdio> and std:rintf.
You can also solve this by putting "using namespace std;" at the global scope. This is not advised behavior. But since you are trying to get C code compiled in C++, it is an option.

Also, if you're using C functionality that is differs from C++, you can put an "extern" around it:

Qt Code:
  1. // C++ code
  2. extern "C"
  3. {
  4. // C code
  5. }
  6. // C++ code
To copy to clipboard, switch view to plain text mode 

This may even be required when creating shared libraries for other C-only applications.