#include <iostream>
using namespace std;
int main() {
cout << "Hello, world!!!!" << endl;
return 0;
}
[xxx@xxx ~]$ su [xxx@xxx ~]# yum install gcc [xxx@xxx ~]# gcc --version [xxx@xxx ~]# yum install gcc-g++ [xxx@xxx ~]# g++ --version
[xxx@xxx ~]$ g++ -c hello.cpp
[xxx@xxx ~]$ g++ -o hello.out hello.o
[xxx@xxx ~]$ g++ -o hello.out hello.cpp
[xxx@xxx ~]$ ./hello.out
/* solution.h */
class Solution {
public:
void Say();
};
/* solution.cpp */
#include <iostream>
#include "solution.h"
void Solution::Say(){
std::cout << "HI!" << std::endl;
}
/* hw2.cpp */
#include "solution.h"
int main () {
Solution sln;
sln.Say();
return 0;
}
build : hw2.o solution.o g++ -o build hw2.o solution.o #注意前面必须是tab,不能是空格 hw2.o : hw2.cpp solution.h g++ -g -c hw2.cpp solution.o : solution.h solution.cpp g++ -g -c solution.cpp clean : rm hw2.o solution.o build
target ... : prerequisites ... command #注意前面是tab
build : hw2.o solution.o g++ -o build hw2.o solution.o
hw2.o : hw2.cpp solution.h g++ -g -c hw2.cpp
solution.o : solution.h solution.cpp g++ -g -c solution.cpp
clean : rm hw2.o solution.o build
[xxx@xxx ~]$ make g++ -g -c hw2.cpp g++ -g -c solution.cpp g++ -o build hw2.o solution.o #注意前面必须是tab,不能是空格 [xxx@xxx ~]$ ./build HI! [xxx@xxx ~]$
1 {
2 "version": "0.2.0",
3 "configurations": [
4 {
5 "name": "C++ Launch",
6 "type": "cppdbg",
7 "request": "launch",
8 "program": "${workspaceRoot}/build",
9 "args": [],
10 "stopAtEntry": false,
11 "cwd": "${workspaceRoot}",
12 "environment": [],
13 "externalConsole": true,
14 "linux": {
15 "MIMode": "gdb"
16 },
17 "osx": {
18 "MIMode": "lldb"
19 },
20 "windows": {
21 "MIMode": "gdb"
22 }
23 },
24 {
25 "name": "C++ Attach",
26 "type": "cppdbg",
27 "request": "attach",
28 "program": "${workspaceRoot}/build",
29 "processId": "${command.pickProcess}",
30 "linux": {
31 "MIMode": "gdb"
32 },
33 "osx": {
34 "MIMode": "lldb"
35 },
36 "windows": {
37 "MIMode": "gdb"
38 }
39 }
40 ]
41 }
1 {
2 "version": "0.2.0",
3 "configurations": [
4 {
5 "name": "C++ Launch",
6 "type": "cppdbg",
7 "request": "launch",
8 "program": "${workspaceRoot}/build",
9 "args": [],
10 "stopAtEntry": false,
11 "cwd": "${workspaceRoot}",
12 "environment": [],
13 "externalConsole": true,
14 "preLaunchTask": "build",
15 "linux": {
16 "MIMode": "gdb"
17 },
18 "osx": {
19 "MIMode": "lldb"
20 },
21 "windows": {
22 "MIMode": "gdb"
23 }
24 },
25 {
26 "name": "C++ Attach",
27 "type": "cppdbg",
28 "request": "attach",
29 "program": "${workspaceRoot}/build",
30 "processId": "${command.pickProcess}",
31 "linux": {
32 "MIMode": "gdb"
33 },
34 "osx": {
35 "MIMode": "lldb"
36 },
37 "windows": {
38 "MIMode": "gdb"
39 }
40 }
41 ]
42 }
1 {
2 "version": "0.1.0",
3 "command": "make",
4 "showOutput": "always",
5 "tasks": [
6 {
7 "taskName": "clean"
8 },
9 {
10 "taskName": "build",
11 "problemMatcher": {
12 "owner": "cpp",
13 "fileLocation": ["relative", "${workspaceRoot}"],
14 "pattern": {
15 "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
16 "file": 1,
17 "line": 2,
18 "column": 3,
19 "severity": 4,
20 "message": 5
21 }
22 }
23 }
24 ]
25 }
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有