Tuesday, July 14, 2009

Can u use c code on microsoft visual c ++ beta?

I have the book "c for dummies" but since you have to buy a copy of visual c i was just wondering if visual c++ beta would work. I realy want to begin to learn to program I cant figure out if you can use the codes from the c lanaguage.

Can u use c code on microsoft visual c ++ beta?
Yes, this should work, as other posters pointed out. If you always compile your own code from source, it should work seamlessly.





However, there is one obscure "gotcha" that I've run into. If you use a library or .o file that was compiled by a plain C compiler and then compile your code with C++, you can have issues with "name mangling" where the C++ compiler gives different names to functions than the C compiler does. To solve this, you use the "extern C" keyword, telling the C++ compiler to treat the code as a C compiler would. But this is a fairly obscure problem that you shouldn't run into until after you've become pretty adventurous with your programming.
Reply:yes, c++ is back compatable such that you can use C code in C++ even if you can't use C++ in a C code compiler.
Reply:All c++ compilers are able to compile c programs according the the ANSI standard.

redbud

No comments:

Post a Comment