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?
That is because
cppisC(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. 🙂