|
发表于 2021-6-19 22:02:00
|
显示全部楼层
不要用微软的安全函数,因为不可移植
这么多报错
- main.cpp: In constructor ‘message::message(int)’:
- main.cpp:133:35: error: request for member ‘name’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 133 | strcpy_s(name_m, strlen(w.name) + 1, w.name);
- | ^~~~
- main.cpp:133:26: error: ‘strlen’ was not declared in this scope
- 133 | strcpy_s(name_m, strlen(w.name) + 1, w.name);
- | ^~~~~~
- main.cpp:2:1: note: ‘strlen’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
- 1 | #include <iostream>
- +++ |+#include <cstring>
- 2 |
- main.cpp:133:48: error: request for member ‘name’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 133 | strcpy_s(name_m, strlen(w.name) + 1, w.name);
- | ^~~~
- main.cpp:133:9: error: ‘strcpy_s’ was not declared in this scope
- 133 | strcpy_s(name_m, strlen(w.name) + 1, w.name);
- | ^~~~~~~~
- main.cpp:134:34: error: request for member ‘sex’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 134 | strcpy_s(sex_m, strlen(w.sex) + 1, w.sex);
- | ^~~
- main.cpp:134:46: error: request for member ‘sex’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 134 | strcpy_s(sex_m, strlen(w.sex) + 1, w.sex);
- | ^~~
- main.cpp:135:34: error: request for member ‘age’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 135 | strcpy_s(age_m, strlen(w.age) + 1, w.age);
- | ^~~
- main.cpp:135:46: error: request for member ‘age’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 135 | strcpy_s(age_m, strlen(w.age) + 1, w.age);
- | ^~~
- main.cpp:136:34: error: request for member ‘num’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 136 | strcpy_s(num_m, strlen(w.num) + 1, w.num);
- | ^~~
- main.cpp:136:46: error: request for member ‘num’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 136 | strcpy_s(num_m, strlen(w.num) + 1, w.num);
- | ^~~
- main.cpp:137:38: error: request for member ‘name’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 137 | strcpy_s(address_m, strlen(w.name) + 1, w.name);
- | ^~~~
- main.cpp:137:51: error: request for member ‘name’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 137 | strcpy_s(address_m, strlen(w.name) + 1, w.name);
- | ^~~~
- main.cpp:138:34: error: request for member ‘tel’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 138 | strcpy_s(tel_m, strlen(w.tel) + 1, w.tel);
- | ^~~
- main.cpp:138:46: error: request for member ‘tel’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 138 | strcpy_s(tel_m, strlen(w.tel) + 1, w.tel);
- | ^~~
- main.cpp:139:37: error: request for member ‘nation’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 139 | strcpy_s(nation_m, strlen(w.nation) + 1, w.nation);
- | ^~~~~~
- main.cpp:139:52: error: request for member ‘nation’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 139 | strcpy_s(nation_m, strlen(w.nation) + 1, w.nation);
- | ^~~~~~
- main.cpp:140:47: error: request for member ‘political_status’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 140 | strcpy_s(political_status_m, strlen(w.political_status) + 1, w.political_status);
- | ^~~~~~~~~~~~~~~~
- main.cpp:140:72: error: request for member ‘political_status’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 140 | strcpy_s(political_status_m, strlen(w.political_status) + 1, w.political_status);
- | ^~~~~~~~~~~~~~~~
- main.cpp:141:45: error: request for member ‘marital_status’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 141 | strcpy_s(marital_status_m, strlen(w.marital_status) + 1, w.marital_status);
- | ^~~~~~~~~~~~~~
- main.cpp:141:68: error: request for member ‘marital_status’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 141 | strcpy_s(marital_status_m, strlen(w.marital_status) + 1, w.marital_status);
- | ^~~~~~~~~~~~~~
- main.cpp:142:37: error: request for member ‘school’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 142 | strcpy_s(school_m, strlen(w.school) + 1, w.school);
- | ^~~~~~
- main.cpp:142:52: error: request for member ‘school’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 142 | strcpy_s(school_m, strlen(w.school) + 1, w.school);
- | ^~~~~~
- main.cpp:143:39: error: request for member ‘identity’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 143 | strcpy_s(identity_m, strlen(w.identity) + 1, w.identity);
- | ^~~~~~~~
- main.cpp:143:56: error: request for member ‘identity’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 143 | strcpy_s(identity_m, strlen(w.identity) + 1, w.identity);
- | ^~~~~~~~
- main.cpp:144:36: error: request for member ‘email’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 144 | strcpy_s(email_m, strlen(w.email) + 1, w.email);
- | ^~~~~
- main.cpp:144:50: error: request for member ‘email’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 144 | strcpy_s(email_m, strlen(w.email) + 1, w.email);
- | ^~~~~
- main.cpp:145:39: error: request for member ‘position’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 145 | strcpy_s(position_m, strlen(w.position) + 1, w.position);
- | ^~~~~~~~
- main.cpp:145:56: error: request for member ‘position’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 145 | strcpy_s(position_m, strlen(w.position) + 1, w.position);
- | ^~~~~~~~
- main.cpp:146:42: error: request for member ‘engage_time’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 146 | strcpy_s(engage_time_m, strlen(w.engage_time) + 1, w.engage_time);
- | ^~~~~~~~~~~
- main.cpp:146:62: error: request for member ‘engage_time’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 146 | strcpy_s(engage_time_m, strlen(w.engage_time) + 1, w.engage_time);
- | ^~~~~~~~~~~
- main.cpp:147:39: error: request for member ‘add_time’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 147 | strcpy_s(add_time_m, strlen(w.add_time) + 1, w.add_time);
- | ^~~~~~~~
- main.cpp:147:56: error: request for member ‘add_time’ in ‘((message*)this)->message::<anonymous>.Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 147 | strcpy_s(add_time_m, strlen(w.add_time) + 1, w.add_time);
- | ^~~~~~~~
- main.cpp: In copy constructor ‘message::message(const message&)’:
- main.cpp:151:26: error: ‘strlen’ was not declared in this scope
- 151 | strcpy_s(name_m, strlen(me.name_m) + 1, me.name_m);
- | ^~~~~~
- main.cpp:151:26: note: ‘strlen’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
- main.cpp:151:9: error: ‘strcpy_s’ was not declared in this scope
- 151 | strcpy_s(name_m, strlen(me.name_m) + 1, me.name_m);
- | ^~~~~~~~
- main.cpp: In member function ‘void Staffoperation::add_person()’:
- main.cpp:236:20: error: ‘strcmp’ was not declared in this scope
- 236 | while (strcmp(w[x].num, num1) == 0)
- | ^~~~~~
- main.cpp:236:20: note: ‘strcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
- main.cpp:244:9: error: ‘strcpy_s’ was not declared in this scope
- 244 | strcpy_s(w[Num].num, num1);
- | ^~~~~~~~
- main.cpp: In member function ‘void Staffoperation::searchname()’:
- main.cpp:324:33: error: request for member ‘name’ in ‘((Staffoperation*)this)->Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 324 | if (strcmp(name1, w.name) == 0) {
- | ^~~~
- main.cpp:324:17: error: ‘strcmp’ was not declared in this scope
- 324 | if (strcmp(name1, w.name) == 0) {
- | ^~~~~~
- main.cpp:324:17: note: ‘strcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
- main.cpp:329:27: error: request for member ‘name’ in ‘((Staffoperation*)this)->Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 329 | cout << w.name << endl;
- | ^~~~
- main.cpp: In member function ‘void Staffoperation::searchnum()’:
- main.cpp:354:26: error: request for member ‘num’ in ‘((Staffoperation*)this)->Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 354 | if (strcmp(w.num, num1) == 0) {
- | ^~~
- main.cpp:354:17: error: ‘strcmp’ was not declared in this scope
- 354 | if (strcmp(w.num, num1) == 0) {
- | ^~~~~~
- main.cpp:354:17: note: ‘strcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
- main.cpp: In member function ‘void Staffoperation::delname()’:
- main.cpp:379:29: error: request for member ‘name’ in ‘((Staffoperation*)this)->Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 379 | if (strcmp(name2, w.name) == 0) {
- | ^~~~
- main.cpp:379:13: error: ‘strcmp’ was not declared in this scope
- 379 | if (strcmp(name2, w.name) == 0) {
- | ^~~~~~
- main.cpp:379:13: note: ‘strcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
- main.cpp:400:37: error: request for member ‘name’ in ‘((Staffoperation*)this)->Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 400 | if (strcmp(name2, w.name) == 0) {
- | ^~~~
- main.cpp:400:21: error: ‘strcmp’ was not declared in this scope
- 400 | if (strcmp(name2, w.name) == 0) {
- | ^~~~~~
- main.cpp:400:21: note: ‘strcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
- main.cpp: In member function ‘void Staffoperation::delnum()’:
- main.cpp:435:22: error: request for member ‘num’ in ‘((Staffoperation*)this)->Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 435 | if (strcmp(w.num, num2) == 0) {
- | ^~~
- main.cpp:435:13: error: ‘strcmp’ was not declared in this scope
- 435 | if (strcmp(w.num, num2) == 0) {
- | ^~~~~~
- main.cpp:435:13: note: ‘strcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
- main.cpp:456:30: error: request for member ‘num’ in ‘((Staffoperation*)this)->Staffoperation::w’, which is of non-class type ‘Worker [101]’
- 456 | if (strcmp(w.num, num2) == 0) {
- | ^~~
- main.cpp:456:21: error: ‘strcmp’ was not declared in this scope
- 456 | if (strcmp(w.num, num2) == 0) {
- | ^~~~~~
- main.cpp:456:21: note: ‘strcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
复制代码 |
|