iostream库和gcc的问题
Problems with iostream library and gcc
我试过很多次编译一个小的c++程序,但是每次我用gcc编译它都失败了。
我使用Cygwin64,这是代码:
#include <iostream>
#include <string.h>
using namespace std;
#define MAX 100
using namespace std;
#define MAX 100
int main(){
int n;
cout<<"Caantidad de elementos a ingresar";
cin>>n;
if(n<=0) {
cout<<"Elementos ingresador no válidos"<<endl;
} if(n>MAX) {
cout<<"La cantidad ingresada no es válida, Maximo "<<MAX<<" : " <<endl;
return n;
}
}
错误是:
$ gcc nuevo.cpp/tmp/curfcpf .o:nuevo.cpp:(.text+0x1c):引用a"std:: basic_ostream>,std:: operator<& lt;> std::basic_ostream>&, char const*)' sindefinir
我很感激你的帮助
用g++
代替gcc
。gcc
用于C程序。g++
用于c++程序
相关文章:
- gcc和clang在表达式是否为常量求值的问题上存在分歧
- GCC 问题与 static_cast<std::u16string>
- 具有sleep_for和sleep_until功能的 gcc 可能存在的问题
- 调试模板时出现问题.专门针对 Linux GCC 7、GCC 6、GCC 5、GCC 4.9 错误构建失败:模板参数 1
- 使用具有默认参数的函数模板进行 decltype 会使结果混乱(一个有趣的问题或 gcc 的错误)
- 没有'str'成员在 GCC 和 Clang 'std::basic_ostream<char>',但 MSVC 没有问题
- macos GCC 工具链编译简单 hello 世界的问题
- 使用不同版本的 gcc 和 g++ 进行编译时出现问题
- C++ GCC 的部分模板专用化问题
- GCC 与 Clang 公共库问题
- 与lambda一起使用虚拟继承在初始化列表中捕获此问题的GCC错误
- 将GCC版本升级到发行版附带的版本以外的版本是否有任何问题
- 在 gcc 中使用 fsanitize 开关的 Boost 出现问题
- 在 Windows 10 中运行 gcc 插件的问题
- Linux 中 gcc 4.3 版本的编译问题
- 当编译指向可能抛出的函数的非throwing时,gcc有什么问题吗
- Linux gcc 编译问题
- GCC:函数包装器模板问题
- 多个声明的问题gcc
- 多重继承的菱形问题:Gcc / Clang错误,但Visual Studio没有错误