Netbeans and C++ installation - c++

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.

Related

C++ application failing to build with 'cannot find -lmysqlpp' but it appears to be there

I'm trying to build an application with Netbeans and getting the following error:
/usr/bin/ld: cannot find -lmysqlpp
I believe this exists as per the below screen shots;
and here in my includes from Netbeans;
The below is the full output from Netbeans;
cd '/media/psf/DL/DL_src/FEC_src/docugirl'
/usr/bin/make -f Makefile CONF=Debug
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/media/psf/DL/DL_src/FEC_src/docugirl'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk /app/bin/docugirl
make[2]: Entering directory '/media/psf/DL/DL_src/FEC_src/docugirl'
mkdir -p /app/bin
g++ -o /app/bin/docugirl build/Debug/GNU-Linux/docugirl.o -lm -lpthread /pcli/library/libcore.a /pcli/library/libsdd.a -lmysqlpp
/usr/bin/ld: cannot find -lmysqlpp
collect2: error: ld returned 1 exit status
make[2]: *** [nbproject/Makefile-Debug.mk:67: /app/bin/docugirl] Error 1
make[2]: Leaving directory '/media/psf/DL/DL_src/FEC_src/docugirl'
make[1]: *** [nbproject/Makefile-Debug.mk:59: .build-conf] Error 2
make[1]: Leaving directory '/media/psf/DL/DL_src/FEC_src/docugirl'
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2
BUILD FAILED (exit value 2, total time: 472ms)
For completeness, the source exists on a remote Debian server (as has previous successfully created and built mysql type applications).
So, I'm a little confused, I thought and assumed that I had the necessary mysql stuff in order to build this, I am able to build other mysql applications with this setup. Is this mysqlpp different/additional to the /usr/include/mysql and /usr/include/mysql++?
The /usr/include/mysql links to /usr/include/mariadb
Any help would be greatly appreciated here, thanks in advance...
#HEKTO This was indeed the problem but it seemed that the current release of Debian (10.5) did not include the libmysql++-dev package, the reasons for which are as yet unknown to me and although I had copied the mysql++ header files across, the libmysqlpp.so was indeed not there. In this instance, I resorted to using a previous release, although I believe the next release will include this.
See here: https://packages.debian.org/stretch/libmysql++-dev

Armadillo code cant compile in msys2 and netbeans

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.

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

Netbeans C/C not compiling

I installed the NetBeans IDE 7.3.1 almost a week ago and still haven't been able to get it to compile anything.
I'm using the Cygwin's compiler for C/C++, and I get the following error message for a simple "Hello World" program:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/c/Users/CaptFuzzyboots/Documents/NetBeansProjects/Hello World'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_1-Windows/hello_world.exe
make[2]: Entering directory `/cygdrive/c/Users/CaptFuzzyboots/Documents/NetBeansProjects/Hello World'
mkdir -p build/Debug/Cygwin_1-Windows
rm -f build/Debug/Cygwin_1-Windows/main.o.d
gcc -c -g -MMD -MP -MF build/Debug/Cygwin_1-Windows/main.o.d -o build/Debug/Cygwin_1-Windows/main.o main.c
make[2]: gcc: Command not found
nbproject/Makefile-Debug.mk:66: recipe for target `build/Debug/Cygwin_1-Windows/main.o' failed
make[2]: *** [build/Debug/Cygwin_1-Windows/main.o] Error 127
make[2]: Leaving directory `/cygdrive/c/Users/CaptFuzzyboots/Documents/NetBeansProjects/Hello World'
nbproject/Makefile-Debug.mk:59: recipe for target `.build-conf' failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/cygdrive/c/Users/CaptFuzzyboots/Documents/NetBeansProjects/Hello World'
nbproject/Makefile-impl.mk:39: recipe for target `.build-impl' failed
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 472ms)
EDIT
I fixed this by just making a new toolkit and adding the base directory as Cygwin -> bin.
The problem now is that I keep getting
Unable to start pty process
gcc: Command not found
You should check whether you have installed gcc (plus gdb and make)
via MinGW:
MinGW+NetBeans (just look at the screenshots, you don't have to understand Hungarian)
via Cygwin:
http://www.eecg.utoronto.ca/~aamodt/ece242/cygwin.html
You should also check whether paths are correct in NetBeans:
Tools > Options > C/C++ > Build Tools:
(At the time of creating the screenshot, I had MinGW installed in C:\Programs\MinGW, BUT if you have it installed in C:\MinGW (which is the default), this correct, too! The only important thing is that you should install MinGW in a path which doesn't contain whitespaces.)
This is what it looks like when paths are incorrect, letters are red:
Note: I have MinGW installed, but it doesn't change the fact that you should check whether YOUR paths are correct.
You should also take care the right Configuration is selected in project Properties (right click on project) > Build - The right "Tool collection" has to be selected (on which the paths above are correct):
Unable to start pty process
Related answer: Can build, but can't run C code in netbeans (but it works in command line)
So right click on the project, Properties > Run > Console Type > External Terminal (instead of e.g. "Internal Terminal"). Here is a screenshot:
Here is your problem:
gcc: Command not found
Cygwin is not a compiler, it's a unix-like environment for Windows. Gcc is the compiler. You have to install gcc with Cygwin before it will work.

Can't Compile C++ Code on NetBeans 7.0

I just installed NetBeans 7.0 with C++ package. It asked for C++ compiler - I installed MinGW. I added it to NetBeans (so it recognize it). I think that it's all correct...
I wrote very simple C++ application in main.cpp and tried to compile it...
#include <cstdlib>
#include <iostream>
int main( int argc, char** argv ) {
std::cout << "Hello, world!";
return 0;
}
It complains about "Make Command" (under Tools -> Options -> C/C++ -> Build Tools). I tried to fix it and type C:\MinGW\msys\1.0\bin\make.exe in there. I tried to compile it again! Here's the error message...
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/Users/admin/Documents/C++/helloWorld'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/helloworld.exe
make[2]: Entering directory `/c/Users/admin/Documents/C++/helloWorld'
make[2]: mkdir: Command not found
mkdir -p build/Debug/MinGW-Windows
make[2]: *** [build/Debug/MinGW-Windows/main.o] Error 127
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `/c/Users/admin/Documents/C++/helloWorld'
make[1]: Leaving directory `/c/Users/admin/Documents/C++/helloWorld'
BUILD FAILED (exit value 2, total time: 2s)
How to fix it and configure NetBeans (with C++ package) correctly?
I guess you didn't add msys to your PATH variable. See this entry in the Netbeans forum, as the error reported there is essentially the same as the one you pasted in your question. 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.
mkdir in Cygwin may be a separate .exe instead of a function of bash. So you may be just missing it for some reason.
"Resolve Missing Native Build Tools" Netbeans Make command problem. Go to -Tools -Options -C/C++ Write to Make Command: C:\MinGW\msys\1.0\bin\make.exe
Solution
Copy mingw32-make.exe from MinGW\bin\ to msys folder, replacing make.exe
not sure why this is necessary but, hey, it worked.