繁体   English   中英

Netbeans C ++编译器错误

[英]Netbeans C++ Compiler Error

首先,我说我是HP笔记本电脑上的Windows 8用户。 因此,我最近在“ c ++ institute”开设了c ++在线课程。 根据他们的建议,我下载了MinGW / MSYS软件包,JDK和NetbBeans IDE版本8.0.2。 我完全按照他们的安装说明进行操作(包括通过添加“; C:\\ MinGW \\ bin; C:\\ MinGW \\ MSYS \\ 1.0 \\ bin”来更新路径目录),现在进入程序的第3章,一切正常,直到我试图编译以下代码(请参见下文)

/* 
 * File:   hello.cpp
 *
 * Created on 19 May 2015, 18:26
 */

#include <cstdlib>
#include <iostream>
#include <stdio.h>

int main(void) {
    int exp;
    int pow = 1;

    for(exp = 0; exp < 16; exp++) {
    printf("2 to the power of %d is %d\n",exp,pow);
        pow = pow*2;
    }
    return 0;
}

由于某些原因,当我尝试编译并运行程序时,出现以下错误消息

"/C/MinGW/MSYS/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE=         SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Users/Philip/Desktop/C++ Course/Hello'
"/C/MinGW/MSYS/1.0/bin/make.exe"  -f nbproject/Makefile-Debug.mk     dist/Debug/MinGW-Windows/hello.exe
make.exe[2]: Entering directory `/c/Users/Philip/Desktop/C++ Course/Hello'
mkdir -p build/Debug/MinGW-Windows
rm -f "build/Debug/MinGW-Windows/hello.o.d"
g++    -c -g -MMD -MP -MF "build/Debug/MinGW-Windows/hello.o.d" -o         build/Debug/MinGW-Windows/hello.o hello.cpp
mkdir -p dist/Debug/MinGW-Windows
g++     -o dist/Debug/MinGW-Windows/hello build/Debug/MinGW-Windows/hello.o 
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot     open output file dist/Debug/MinGW-Windows/hello.exe: Permission denied
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/hello.exe] Error 1
make.exe[2]: Leaving directory `/c/Users/Philip/Desktop/C++ Course/Hello'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/Philip/Desktop/C++ Course/Hello'
make.exe": *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 4s)

代码直接从课程文件中复制并粘贴,对我来说似乎很有意义。 那么有人可以告诉我我在做什么错吗? 提前致谢。

相关的错误消息是

 cannot open output file dist/Debug/MinGW-Windows/hello.exe: Permission denied 

这表明您没有尝试在其中创建hello.exe的文件夹上的写权限。将dist/Debug/MinGW-Windows文件夹设置为可写,然后应解决该错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM