1:ld returned 1 exit status
程序被满写(通常是在执行一个程序时再次执行时发生的),只要把程序关掉并把exe删掉就可以了。
2:‘xxx’ was not declared in this scope
xxx变量、常量或函数并为定义。
3:‘long long long’ is too long for GCC
你尝试定义一个long long long类型的变量。
4:#error xxx
你在程序中添加了预处理指令error。
5:multiple definition of xxx first defined here
xxx被多次定义了。
6:crosses initialization of ‘xxx’
在goto后面定义变量是不合法的(G++的bug还是feature?)。
7:cannot convert ‘std::string {aka std::basic_string}’ to ‘const char*’ for argument ‘1’ to ‘xxx’
不能在xxx函数中的const char*参数调用string变量(C++的SB Feature),必须先转成const char*,
8:expected ‘;’ after class definition
类的定义后面没加分号
9:expected ‘;’ before ‘xxx’
在xxx函数后没加分号。
10:invalid preprocessing directive #xxx
未知的预处理指令xxx(不包含#import)。
11:如果全部函数都是not declare in this scope的话,有可能是没有using namespace std;。
12:xxx: No such file or directory
没有xxx这个文件或目录。
13:stray ‘\xxx’ in program
出现中文字符或其它非ascii码字符。

这篇博客列举了C++编程中常见的错误,如程序满写、未声明的变量、类型过长、预处理指令错误等,并提供了相应的解决方法。还提到了头文件缺失、非法初始化和未知预处理指令等问题,对于C++初学者和开发者来说,这些都是需要注意和避免的陷阱。

734

被折叠的 条评论
为什么被折叠?



