簡體   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