How to compile C++ under Ubuntu Linux?

前端 未结 11 1752
伪装坚强ぢ
伪装坚强ぢ 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 08:45

    Use g++. And make sure you have the relevant libraries installed.

    0 讨论(0)
  • 2020-12-09 08:48

    Install gcc and try the video below.
    Try this:
    https://www.youtube.com/watch?v=A6v2Ceqy4Tk
    Hope it will works for you.

    0 讨论(0)
  • 2020-12-09 08:50

    you can use g++ --std=c++0x example.cpp -o example

    0 讨论(0)
  • 2020-12-09 08:56

    You probably should use g++ rather than gcc.

    0 讨论(0)
  • 2020-12-09 09:01

    g++ is the C++ compiler under linux. The code looks right. It is possible that you are missing a library reference which is used as such:

    g++ -l{library name here (math fns use "m")} codefile.cpp

    0 讨论(0)
  • 2020-12-09 09:02

    Use

    g++

    space followed by the program name. e.g:

    g++ prog.cpp

    if the filename was "prog.cpp" in this case. if you want to run the program write:

    ./prog
    

    so i used

    "prog"

    because it was my filename.

    0 讨论(0)
提交回复
热议问题