Empty_Android 2016-08-27 07:16 采纳率: 70.6%
浏览 1590
已采纳

C++ 基本IO 加和出现错误

实现加法算法,代码和错误信息如下:

 #include <iostream>
using namespace std;

/*
 * 
 */
int main() {

    cout<<"Enter two numbers:"<<endl;
    int v1 = 0,v2 = 0;
    cin >> v1 >> v2; 
    cout << "The sum of " << v1 << "and" << v2 << "is" <<
            v1 + v2 << endl;

    return 0;
 cd 'D:\C++\workspace\CppApplication_1'
D:\C++\MSYS\bin\make.exe -f Makefile CONF=Debug
"/D/C++/MSYS/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/d/C++/workspace/CppApplication_1'
"/D/C++/MSYS/bin/make.exe"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/cppapplication_1.exe
make.exe[2]: Entering directory `/d/C++/workspace/CppApplication_1'
mkdir -p dist/Debug/MinGW-Windows
g++     -o dist/Debug/MinGW-Windows/cppapplication_1 build/Debug/MinGW-Windows/main.o 
d:/c++/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -lpthread
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/cppapplication_1.exe] Error 1
make.exe[2]: Leaving directory `/d/C++/workspace/CppApplication_1'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/d/C++/workspace/CppApplication_1'
make.exe": *** [.build-impl] Error 2

构建 FAILED (退出值2, 总时间:  306ms)

  • 写回答

4条回答 默认 最新

  • WarmSword 2016-08-29 11:25
    关注

    代码没问题 在ubuntu1604LTS下亲测了 g++可以正常编译 运行 感觉 应该是 工具链配置有问题 楼主查查IDE的配置吧

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器