Why can't I compile HelloWorld in C++?

后端 未结 5 1479
北恋
北恋 2021-01-14 02:54

I\'m trying to compile a simple Hello World program in C++ but I keep getting the following error...why?

gcc -o HelloWorldCompiled HelloWorld.cc
/tmp/ccvLW1e         


        
5条回答
  •  抹茶落季
    2021-01-14 03:20

    Use g++ not gcc. gcc is a C compiler, whereas g++ is a C++ compiler.

    g++ -o hwcompiled helloworld.cc
    

    Then to execute your compiled program:

    ./hwcompiled
    

提交回复
热议问题