I want to compile the Linux kernel (written in c) using g++. Is this possible? If not, could you suggest ways of accomplishing it?
Asked
Active
Viewed 1,276 times
5
-
So you want to compile C code with a C++ compiler? Why, if I may? – Michael Foukarakis Apr 28 '11 at 05:15
-
1NO i just want to check the incompatabilities of c and c++. – santosh Apr 28 '11 at 05:18
1 Answers
2
Why would you want to do that??? Just use gcc. Compiling towards a C++ environment/runtime is not possible as in the kernel there is no way to run a C++ runtime. This would imply having exception handling available for example, which is very problematic in the kernel. So you have to stick to a C compiler like intel's C compiler icc
or gcc
.
Here is another question that might interest you: Is it possible to compile Linux kernel with something other than gcc?
Another Reference: Why don't we rewrite the Linux kernel in C++?