when I compile this program in Netbeans, the program shows the text in the output- What is it I'm doing wrong that causes this error and how do I fix it?
This is the Code I'm using:
/*
* File: main.cpp
* Author: Oliver
*
* Created on May 4, 2014, 12:33 AM
*/
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
cout << "Hello World!";
return 0;
}
This is the results...:
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/sers/Oliver/Documents/NetBeansProjects/Learning'
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/learning.exe
make.exe[2]: Entering directory `/c/sers/Oliver/Documents/NetBeansProjects/Learning'
mkdir -p build/Debug/MinGW-Windows
make.exe[2]: mkdir: Command not found
make.exe[2]: *** [build/Debug/MinGW-Windows/main.o] Error 127
make.exe[2]: Leaving directory `/c/sers/Oliver/Documents/NetBeansProjects/Learning'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/sers/Oliver/Documents/NetBeansProjects/Learning'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)
Look into your /C/MinGW/msys/1.0/bin/ for mkdir.exe .
if you found it there, you have not set your path environment variable to that folder.
C:\MinGW\msys\1.0\bin;C:\MinGW\bin;
So add it at the first place.
I apologize for the somewhat atypical picture. Binn currently working on a win2000 computer and can not switch.
If this is not enough, you can set manually "make.exe" into the C/C++ NetBeans Properties > Make Command textbox.
It's located in the path said in the previous answer.
C:\MinGW\msys\1.0\bin\make.exe
Related
I am working on a program for a class. Yesterday my progress so far was working.
Today my output shows nothing. I've been working at trying to find the problem - and concluded that something must have happened in NetBeans. Below is a program that I made just to test this - this is not my class project (I wish it were this simple).
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
cout<<"anything"<<endl;
return 0;
}
if I go to run>test project I receive the following output:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/Pietzyk/Desktop/School/CSCI455/labs/NumsTester/cPlusTribulation'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/cplustribulation.exe
make[2]: Entering directory '/cygdrive/c/Users/Pietzyk/Desktop/School/CSCI455/labs/NumsTester/cPlusTribulation'
make[2]: 'dist/Debug/Cygwin-Windows/cplustribulation.exe' is up to date.
make[2]: Leaving directory '/cygdrive/c/Users/Pietzyk/Desktop/School/CSCI455/labs/NumsTester/cPlusTribulation'
make[1]: Leaving directory '/cygdrive/c/Users/Pietzyk/Desktop/School/CSCI455/labs/NumsTester/cPlusTribulation'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-tests-conf
make[1]: Entering directory '/cygdrive/c/Users/Pietzyk/Desktop/School/CSCI455/labs/NumsTester/cPlusTribulation'
make[1]: *** No rule to make target '.build-tests-conf'. Stop.
make[1]: Leaving directory '/cygdrive/c/Users/Pietzyk/Desktop/School/CSCI455/labs/NumsTester/cPlusTribulation'
nbproject/Makefile-impl.mk:67: recipe for target '.build-tests-impl' failed
make: *** [.build-tests-impl] Error 2
BUILD TESTS FAILED (exit value 2, total time: 1s)
I do not know what any of this means. Although I'm assuming that the line with "*** No rule to make target" must be some sort of indicator as to my issue. I receive the same message with my class project.
When ran my output is:
RUN SUCCESSFUL (total time: 79ms)
if I go to run>test project
Test project requires you to actually have tests. You don't so that why your build is failing.
You should use Run / Run project or Build Project.
Or find this button .
As for the output: You have under Project properties (Right click project name). Choose the Run category. Here you have several options, Console type, where to direct cout.
As with most of my programming woes - such a simple fix:
Somewhere I must have fat-fingered something to where in the run>set main project I had changed what my main was.
Thanks Captain Giraffe for helping me trouble-shoot and get down to this problem.
I have a C++ DLL, something I have used several times. I use Netbeans, with MinGW.
I'm not sure when this began happening exactly, I made some small changes to the code and then began having problems. Basically, I can open Netbeans, open the project, execute a Clean and Build, and it passes, creating the DLL. However, if I try and do it again, it passes the clean, but fails the build. Here's the output from when it fails the second Clean and Build.
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .clean-conf
make.exe[1]: Entering directory `absolute path here...'
rm -f -r build/Release
rm -f dist/Release/MinGW-Windows/myfile.dll
make.exe[1]: Leaving directory `absolute path here...'
CLEAN SUCCESSFUL (total time: 2s)
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `absolute path here...'
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Release.mk dist/Release/MinGW-Windows/myfile.dll
make.exe[2]: Entering directory `absolute path here...'
mkdir -p build/Release/MinGW-Windows
make.exe[2]: mkdir: Command not found
make.exe[2]: *** [build/Release/MinGW-Windows/Main.o] Error 127
make.exe[2]: Leaving directory `absolute path here...'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `absolute path here...'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 2s)
Along with this, my DLL which had been executing without errors in my external program, now will not execute at all. I can't help but think the two issues are related. If I run it more times, I'll get a different message, which seems highly unusual...it cant execute a rm command?
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .clean-conf
make.exe[1]: Entering directory `absolute path here...'
rm -f -r build/Release
make.exe[1]: rm: Command not found
make.exe[1]: Leaving directory `absolute path here...'
make.exe[1]: *** [.clean-conf] Error 127
make.exe": *** [.clean-impl] Error 2
CLEAN FAILED (exit value 2, total time: 1s)
If you need more information let me know, I'm pretty lost here so any help is appreciated. Thanks!
rm and mkdir are normally unix commands that have to be added to the PATH to make them work on windows.
Try going to the control panel, search for "environment" to open the environment panel and edit the PATH to add the directory for rm.exe and mkdir.exe (I am guessing C:\msys\1.0\bin).
After that you probably want to restart netbeans and any cmd shells you have open.
Let me start by saying that I am a Windows 8 user on a HP laptop.
So I very recently started an online course in c++ with 'c++ institute'. As recommended by them, I downloaded the MinGW/MSYS package, JDK and NetbBeans IDE version 8.0.2.
I followed their installation instructions exactly (including updating the path directory by adding ";C:\MinGW\bin;C:\MinGW\MSYS\1.0\bin")
I am now on chapter 3 of the program and everything was going ok until I tried to compile the following code (see below)
/*
* 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;
}
For some reason when I try to compile and run the program I get the following error messages
"/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)
The code was copied and pasted directly from the course files and it seems to make sense to me. So can anybody tell me what I am doing wrong? Thanks in advance.
The relevant error message is
cannot open output file dist/Debug/MinGW-Windows/hello.exe: Permission denied
Which indicates you do not have write permission on the folder it's attempting to create hello.exe in. Make the dist/Debug/MinGW-Windows folder writable, and that error should be resolved.
https://netbeans.org/community/releases/80/cpp-setup-instructions.html#compilers_windows
Try by instructions given over here.
I just can't build a C/C++ project in NetBeans. The environment variable is properly set.
Error :
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Users/Rahul/Documents/NetBeansProjects/CppApplication_1'
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/cppapplication_1.exe
make.exe[2]: Entering directory `/c/Users/Rahul/Documents/NetBeansProjects/CppApplication_1'
mkdir -p build/Debug/MinGW-Windows
make.exe[2]: mkdir: Command not found
make.exe[2]: *** [build/Debug/MinGW-Windows/main.o] Error 127
make.exe[2]: Leaving directory `/c/Users/Rahul/Documents/NetBeansProjects/CppApplication_1'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/Rahul/Documents/NetBeansProjects/CppApplication_1'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 2s)
Code :
#include <stdio.h>
int main(void) {
printf("hello");
return 0;
}
NetBeans-1 :
NetBeans-2 :
The problem is that the "make" from msys looks for the msys mkdir but can't find it because you are not running in an msys environment.
The safe way to solve this is to launch NetBeans from the msys shell.
Alternatively you can manually create the directory as gcc/g++/... itself is also found on the path outside of an msys environment.
Everytime I try to build my c++ file I get this error
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/Users/Joey/Documents/NetBeansProjects/C++Train'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/c__train.exe
make[2]: Entering directory `/c/Users/Joey/Documents/NetBeansProjects/C++Train'
make[2]: mkdir: Command not found
mkdir -p build/Debug/MinGW-Windows
make[2]: Leaving directory `/c/Users/Joey/Documents/NetBeansProjects/C++Train'
make[1]: Leaving directory `/c/Users/Joey/Documents/NetBeansProjects/C++Train'
make[2]: *** [build/Debug/MinGW-Windows/HelloWorld.o] Error 127
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 2s)
I checked the directory the make.exe was in and mkdir was there so I'm just baffled.
my code itself shows no errors:
#include <iostream>
int main() {
using namespace std;
cout << "Hello World!" << endl;
return 0;
}
Just a simple little hello world to test netbeans.
I guess you didn't add msys to your PATH variable. See this entry in the Netbeans forum(http://forums.netbeans.org/topic38061.html) So, the error message you received does not complain about make, it complains that it can't find mkdir, which is supposed to be in a directory in your msys directory. Adding C:\MinGW\msys\1.0\bin\ to your windows PATH variable will probably be sufficient to fix this.