본문 바로가기
Major subject/Computer & Circuit

c++ programming using Linux

by No Brainer 2022. 3. 8.

example:

 

dongjun@DESKTOP-L938ISF:~$ vi [test1].cpp

dongjun@DESKTOP-L938ISF:~$ g++ [test1].cpp -o [test1]
dongjun@DESKTOP-L938ISF:~$ ls
'[test1]'  '[test1].cpp'
dongjun@DESKTOP-L938ISF:~$ ./[test1]
hello
dongjun@DESKTOP-L938ISF:~$ vi [test2].cpp
dongjun@DESKTOP-L938ISF:~$ g++ [test2].cpp -o [test2]
[test2].cpp: In function ‘int main()’:
[test2].cpp:7:6: error: ‘i’ was not declared in this scope
    7 |  for(i=0;i<=10;i++)
      |      ^
dongjun@DESKTOP-L938ISF:~$ vi [test2].cpp
dongjun@DESKTOP-L938ISF:~$ g++ [test2].cpp -o [test2]
dongjun@DESKTOP-L938ISF:~$ ls
'[test1]'  '[test1].cpp'  '[test2]'  '[test2].cpp'
dongjun@DESKTOP-L938ISF:~$ ./[test2]
0
1
2
3
4
5
6
7
8
9
10
dongjun@DESKTOP-L938ISF:~$

 

 

/////

vi는 .cpp파일 열람 및 편집 가능.

진입 이후 i누르면 글자 쓸 수 있음. 코딩 한 이후, esc키 > :wq > enter  로 탈출

'Major subject > Computer & Circuit' 카테고리의 다른 글

[데이터구조] c++ programming using linux  (0) 2022.03.08
website for c++ & c study  (0) 2022.03.08