33,311
社区成员
发帖
与我相关
我的任务
分享
21:55:52 **** Build of configuration Debug for project VariableLab ****
make all
'Building file: ../ExternFile.cpp'
'Invoking: GCC C++ Compiler'
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"ExternFile.d" -MT"ExternFile.d" -o "ExternFile.o" "../ExternFile.cpp"
../ExternFile.cpp: In function 'int main()':
../ExternFile.cpp:12:41: error: 'strlen' was not declared in this scope
cout << str << " strlen=" << strlen(str) << endl;
^
make: *** [ExternFile.o] Error 1
21:55:53 Build Finished (took 735ms)
#include <iostream>
#include <string> // #include <cstring>或者#include <string.h>则是正常运行的
using namespace std;
int main() {
char str[] = "China";
cout << str << " strlen=" << strlen(str) << endl;
return 0;
}