I am a beginner in C++
I am average at C.
I have written the following code in C++ (file.cpp)
#include <iostream>
int main(){
   std::cout<<"My name is ANTHONY";
}
Then I tried to compile the above code using cpp file.cpp but got some errors.
I don't know whats wrong
When I tried to compile my C program (changed <iostream> to <stdio.h> and std::cout to printf) using cc file.c, I didn't get any errors.
What is happening here?
Then I tried to compile the above code using cpp file.cpp but got some errors.
That is because cpp is C(C++) preprocessor. It is a separate program invoked by the compiler (g++) as the first part of translation.
Try compiling your code using g++ file.cpp. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With