How to compile C++ under Ubuntu Linux?

前端 未结 11 1847
伪装坚强ぢ
伪装坚强ぢ 2020-12-09 08:35

I cut&pasted the below code from a previous question into a file called \"avishay.cpp\" and then ran

gcc avishay.cpp

only to get the f

11条回答
  •  失恋的感觉
    2020-12-09 09:03

    You should use g++, not gcc, to compile C++ programs.

    For this particular program, I just typed

    make avishay
    

    and let make figure out the rest. Gives your executable a decent name, too, instead of a.out.

提交回复
热议问题