Unable to build NetBeans C/C++ Project - c++

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.

Related

gmake [nbproject/Makefile-impl.mk:40: .build-impl] Error 2

I have an issue when building & running my application using NetBeans, this is a C++ project.
I'm using ubuntu :
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
Here is the error message :
> cd '/home/antoine/NetBeansProjects/CppApplication_1'
/usr/bin/gmake -f Makefile CONF=Debug
"/usr/bin/gmake" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
gmake[1]: Entering directory '/home/antoine/NetBeansProjects/CppApplication_1'
"/usr/bin/gmake" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux/cppapplication_1
gmake[2]: Entering directory '/home/antoine/NetBeansProjects/CppApplication_1'
gmake[2]: *** No rule to make target 'html_files/about.html.c', needed by 'build/Debug/GNU-Linux/html_files/about.html.o'. Stop.
gmake[2]: Leaving directory '/home/antoine/NetBeansProjects/CppApplication_1'
gmake[1]: *** [nbproject/Makefile-Debug.mk:63: .build-conf] Error 2
gmake[1]: Leaving directory '/home/antoine/NetBeansProjects/CppApplication_1'
gmake: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2
BUILD FAILED (exit value 2, total time: 56ms)
I'm not really sure what I should include more so I'll add whatever you need.

My C++ DLL fails to compile except when I first open the project (in Netbeans)

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.

Can't Compile Hello World in Netbeans

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

run error using MinGW with netbeans 7.3.1

I Installed MinGW and i'm using it with netbeans. However when i try to run a simple "Hello world" programm it gives me the following error:
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build- conf
make.exe[1]: Entering directory `/c/Users/Notandi/Documents/NetBeansProjects/somegame'
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW_1- Windows/somegame.exe
make.exe[2]: Entering directory `/c/Users/Notandi/Documents/NetBeansProjects/somegame'
mkdir -p dist/Debug/MinGW_1-Windows
g++ -o dist/Debug/MinGW_1-Windows/somegame build/Debug/MinGW_1-Windows/main.o - lmingw32 -lSDL2main -lSDL2.dll
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot open output file dist/Debug/MinGW_1-Windows/somegame.exe: Permission denied
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW_1-Windows/somegame.exe] Error 1
make.exe[2]: Leaving directory `/c/Users/Notandi/Documents/NetBeansProjects/somegame'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/Notandi/Documents/NetBeansProjects/somegame'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 3s)
I have checked if the program is running in background, but it isn't.
im using windows 64bit and using MinGW for c++.
I simply configured NetBeans to use MinGW and faced the same inconveniences, but soon simply
decided to use NetBeans with "Run as an administrator", which helped (and so even made "Run as an administrator" unnecessary in further runs). And on a next week I can reinstall MinGW + MSYS in another manner. I'm citing:
The NetBeans IDE might have issues when you try to build and run projects later if MSYS is installed under a limited user account

Error in C++ netbeans mkdir not found?

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.