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.
Related
I'm tring to compile a simple armadillo program by netbeans and msys2:
#include <cstdlib>
#include <armadillo>
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
arma::Mat<double> A = arma::randu(4,4);
return 0;
}
I'm using netbeans 8.2, msys2 installed and configured with openblas and armadillo installed by pacman.
but I get this error:
cd 'D:\Users\Amir\Documents\NetBeansProjects\physics\CppApplication_2'
C:\msys64\usr\bin\make.exe -f Makefile CONF=Release
"/C/msys64/usr/bin/make.exe" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/d/Users/Amir/Documents/NetBeansProjects/physics/CppApplication_2'
"/C/msys64/usr/bin/make.exe" -f nbproject/Makefile-Release.mk dist/Release/MinGW-Windows/cppapplication_2.exe
make[2]: Entering directory '/d/Users/Amir/Documents/NetBeansProjects/physics/CppApplication_2'
mkdir -p build/Release/MinGW-Windows
rm -f "build/Release/MinGW-Windows/main.o.d"
g++ -c -O2 -std=c++11 -MMD -MP -MF "build/Release/MinGW-Windows/main.o.d" -o build/Release/MinGW-Windows/main.o main.cpp
In file included from C:/msys64/mingw64/include/armadillo:54,
from main.cpp:15:
C:/msys64/mingw64/include/armadillo_bits/compiler_setup.hpp:66:30: fatal error: C:/building/msys64/mingw64/include/hdf5.h: No such file or directory
#define ARMA_INCFILE_WRAP(x) <x>
^
compilation terminated.
make[2]: *** [nbproject/Makefile-Release.mk:68: build/Release/MinGW-Windows/main.o] Error 1
make[2]: Leaving directory '/d/Users/Amir/Documents/NetBeansProjects/physics/CppApplication_2'
make[1]: *** [nbproject/Makefile-Release.mk:59: .build-conf] Error 2
make[1]: Leaving directory '/d/Users/Amir/Documents/NetBeansProjects/physics/CppApplication_2'
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2
BUILD FAILED (exit value 2, total time: 575ms)
I also installed hdf5 in msys2.
How can I get rid of this error?
thx.
it seems someone put this #define ARMA_HDF5_INCLUDE_DIR C:/building/msys64/mingw64/include/ into config.hpp in folder armadillo_bits. changing this to your usual include directory or setting it as nothing should fix the problem.
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
i have a litle problem using Netbeans 7.4 and Cygwin 4.x for compiling my C++ programms. I've done everything as in netbeans tutorial. I've installed gcc, gdb, g++ and make compilers. Everything is setup properly in Netbeans properties, every path. But i still get the same problem, i don't know what is this problem. I'm trying to compile Hello sample from Netbeans. Please help me. Here is the error log:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/Dragosh/Documents/NetBeansProjects/Welcome_2'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/welcome_2.exe
make[2]: Entering directory '/cygdrive/c/Users/Dragosh/Documents/NetBeansProjects/Welcome_2'
mkdir -p build/Debug/Cygwin_4.x-Windows
g++ -c -g -o build/Debug/Cygwin_4.x-Windows/welcome.o welcome.cc
In file included from /usr/include/sys/reent.h:14:0,
from /usr/include/wchar.h:6,
from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/cwchar:44,
from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/bits/postypes.h:40,
from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/iosfwd:40,
from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/ios:38,
from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/ostream:38,
from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/iostream:39,
from welcome.cc:31:
/usr/include/sys/_types.h:72:20: fatal error: stddef.h: No such file or directory
#include <stddef.h>
^
compilation terminated.
nbproject/Makefile-Debug.mk:66: recipe for target 'build/Debug/Cygwin_4.x-Windows/welcome.o' failed
make[2]: *** [build/Debug/Cygwin_4.x-Windows/welcome.o] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/Dragosh/Documents/NetBeansProjects/Welcome_2'
nbproject/Makefile-Debug.mk:59: recipe for target '.build-conf' failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/Dragosh/Documents/NetBeansProjects/Welcome_2'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 467ms)
Got this issue with cygwin too, after last update to 2.830 (see setup.exe version). I am using 64 bit version. To verify that we have the same issue, try manualy compiling something supersimple with g++ usgin cygwin terminal.
I checked with:
$ echo -e "#include <iostream>\n int main() { return 0; }" | g++ -xc++ -
And got:
In file included from /usr/include/sys/reent.h:14:0,
from /usr/include/wchar.h:6,
from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/cwchar:44,
from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/bits/postypes.h:40,
from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/iosfwd:40,
from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/ios:38,
from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/ostream:38,
from /usr/lib/gcc/x86_64-pc-cygwin/4.8.1/include/c++/iostream:39,
from <stdin>:1:
/usr/include/sys/_types.h:72:20: fatal error: stddef.h: No such file or directory
#include <stddef.h>
^
compilation terminated.
I noticed that there are two folders of gcc here
C:\cygwin\lib\gcc\x86_64-pc-cygwin\4.8.1
C:\cygwin\lib\gcc\x86_64-pc-cygwin\4.8.2
and g++ --version gives 4.8.2
Running Cygwin's latest Setup.exe and looking for installed packets showed that versions mismatch for gcc-core and gcc-g++ :
gcc-core = 4.8.2-1
gcc-c++ = 4.8.1-3
I downgraded gcc-core to 4.8.1-3 and fixed the issue.
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
PROBLEM SOLVED
Go to bottom to see the solution.
Hello everybody i've been googling' looooong time and I didn't find anythinig, so, here we go:
I have this setup:
Compiler: MinGW IDE: Netbeans Library: SDL Language:
C++
Okey, so, i have included this folder: "C:/SDL_1.2.15/include"
And Linked those libraries in this order:
-lmingw32
-lSDL_main
-lSDL
Then if I use a normal program without the #include "SDL/SDL.h" then compiles okeey.
So if i include the SDL header file the IDE gives me greenlight to compile an then, i get this output:
"C:/WinAVR-20090313/utils/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `C:/Users/pablo/Documents/NetBeansProjects/SDL_Test'
"C:/WinAVR-20090313/utils/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/sdl_test.exe
make[2]: Entering directory `C:/Users/pablo/Documents/NetBeansProjects/SDL_Test'
mkdir -p build/Debug/MinGW-Windows
rm -f build/Debug/MinGW-Windows/main.o.d
g++.exe -c -g -Wall -I/C/MinGW/include -I/C/SDL-1.2.15/include -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
make[2]: Leaving directory `C:/Users/pablo/Documents/NetBeansProjects/SDL_Test'
make[1]: Leaving directory `C:/Users/pablo/Documents/NetBeansProjects/SDL_Test'
main.cpp:11:21: error fatal: SDL/SDL.h: No such file or directory
compilaci�n terminada.
make[2]: *** [build/Debug/MinGW-Windows/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 2s)
So! Here is the source code of my application, it only has a 'main.cpp' file:
/*
* File: main.cpp
* Author: pablo
*
* Created on 1 de septiembre de 2013, 23:20
*/
#include <cstdlib>
#include <windows.h>
#include <SDL/SDL.h>
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
return 0;
}
I've found new issues; When I remove the #include (comment //) then the console throws me this errors instead the 'no such file or directory':
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lSDLmain
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lSDL.dll
When I compile without #include using Cygwin compiler, the project builds correctly.
Found another issue:
make[2]: *** No rule to make target `/C/SDL-1.2.15/lib/libSDLmain.a', needed by `dist/Debug/MinGW-Windows/sdl_test.exe'. Stop.
this happens when I add the full path to the SDL libraries instead of -lSDL.dll and -lSDL_main
SOLUTION:
The problem solves coping c:/SDL-1.15/include/SDL/ folder to c:/MinGW/include/ directory, and libraries from lib on c:/SDL-1.15/lib/SDL to MinGW/lib
You have to add the headers separately.
It's not enough to do the include, you have to do multiple things to add a thing like SDL in your project.