   Why do the books and tutorials insist that I compile as C and not C++?
  The Windows programming guide and OpenGL book tell me I must use .c and not .cpp, why is this? Is there something horribly wrong with C++ that does not mix with OpenGl or Windows?Is it OK to change the code to c++?   
  They tell you to compile as C instead of C++ the same way as you shouldn't compile in Java or C# or PHP: the code was written in the C language, so you shouldn't treat it as if it were another language. And before you mention it, C++ is not a superset of C, there are things which work in C but don't in C++, and things which act differently in the two languages (for instance, void f()).You can change the code to C++, because the two languages are similar enough to compile code that was originally in C with a C++ compiler with only minimal modifications, but don't expect to change the file extension from .c to .cpp and have it magically work—you'll need to read through code and change some bits.   ;Quote:Original post by ToohrVykThey tell you to compile as C instead of C++ the same way as you shouldn't compile in Java or C# or PHP: the code was written in the C language, so you shouldn't treat it as if it were another language. And before you mention it, C++ is not a superset of C, there are things which work in C but don't in C++, and things which act differently in the two languages (for instance, void f()).You can change the code to C++, because the two languages are similar enough to compile code that was originally in C with a C++ compiler with only minimal modifications, but don't expect to change the file extension from .c to .cpp and have it magically work—you'll need to read through code and change some bits.Yes yes, this is what I mean. So there is no problem with using C++? =)   ;  Just give it a go, if you hit any specific problems then post back here with details and we can help walk you through them :-)   ;Quote:Original post by yurianThe Windows programming guide and OpenGL book tell me I must use .c and not .cpp, why is this? Is there something horribly wrong with C++ that does not mix with OpenGl or Windows?Is it OK to change the code to c++?Change - yes. Recompile - perhaps not.Almost all compiler suites today integrate both, C and C++ compiler, due to their large similarity and many shared concepts.Despite that, they are not identical languages. You're not likely to hit any major problems if you choose C++ (with integrated C) compiler. Possible problems however may arise from mixing C++ and C, as well as linking differently compiled modules. On the other hand, using C code from C++, especially passing data, is quite likely to cause many problems impossible to solve without resorting to proper use of C.;  You can do both windows and OpenGL programming in C or C++ if that's what you're asking, you're not stuck with having to use C.   