Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Does a program written in C could possibly work with a C++ compiler?
Please don't write long epics! I just need an answer that i can read without scrolling down the mouse wheel
15 Answers
- BalkLv 61 decade ago
Possibly, yes. It depends on the code and the external functions that are called. Also, if the C source calls some procedures within the source file and there are no function prototypes declared, then the C++ compiler might complain about it.
- 1 decade ago
In most cases, you should have no difficulty compiling C source with a C++ compiler. Make sure the libraries referenced in the source are able to be found by the linker.
Different compilers may have different capabilities. Check your documentation. The "free" compiler GCC will do it.
- ?Lv 45 years ago
frequently, i choose for a compiler consistent with the place the code will run. i take advantage of the two the Microsoft and GNU compilers: MS seen C++ for domicile windows-in straight forward terms purposes, and GNU C++ for Linux and go-platform. i do no longer strengthen for Apple systems, yet as quickly as I had to--and had to jot down in C++ as a replace of the extra huge-unfold purpose C for Apple apps--i might seem heavily at Xcode's C/C++ compiler. Ditto for IBM AIX mainframes, the place the IBM compiler is the only to triumph over. in accordance to a Computerworld article, MS domicile windows nonetheless has over ninety% of the OS marketplace even after gentle declines in present day times. So, like yet another responder reported, MS seen Studio is the oftentimes occurring.
- How do you think about the answers? You can sign in to vote the answer.
- 1 decade ago
Depends on the simplicity of the code.
C++ is a branch off C, so it really depends on the compiler. Most C++ compilers will not compile straight C code.
- 1 decade ago
Yes it will. C is a sub set of C++. or C++ is a derived class of C.
Whatever it may be it will compile.
- Anonymous1 decade ago
Yes! Surely the need is just to #include all the files in which the prototypes of function used are kept.
- 1 decade ago
first... hello!!!!
actually im not a professional C programmer but i think i now some stuff cause i love C language esp TURBO C....
so back to your question...
it should work ... but be sure that u do follow the C++ rules.
beacause turbo C do excepmtion on these rules..
example..
in decalring HEader FIles.. TUrbo C do allow codes without delclaring their Header file..
EX. the CLRSCR() it is under CONIO.h
many more.
FUNCTION prototype should be included in C++ but its allowed in turbo C...
i think thats it... ill send you more when i think one..
i hope it helps...
- ★Greed★Lv 71 decade ago
Almost always, as long as no mixing of fancy code from borland (bad), gnu gcc (ANSII & STL good), and Microsoft (bad).
If its good code it should port perfectly fine to CPP (C Pre Parser)