netbeans build failed exit value 2? - c

I have looked at some other threads on here, but haven't been able to understand what was being suggested as a solution. This is a simple Hello World program that gives this error, though I've tried inserting code I know to be sound and I still get the same result.
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Users/Caleb/Documents/NetBeansProjects/helloworld2'
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/helloworld2.exe
make.exe[2]: Entering directory `/c/Users/Caleb/Documents/NetBeansProjects/helloworld2'
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/Caleb/Documents/NetBeansProjects/helloworld2'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/Caleb/Documents/NetBeansProjects/helloworld2'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)

Related

netbeans c program build fail with tdm-gcc msys

i have recently started to use netbeans to program in c. i usually use codeblocks. i have installed tdm-gcc and msys for this purpose.
the programs are getting compiled successfully. but on execution, it shows build failed(exit value 2).
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/f/NetBeansProjects/C_Programs'
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW_TDM-Windows/c_programs.exe
make.exe[2]: Entering directory `/f/NetBeansProjects/C_Programs'
mkdir -p build/Debug/MinGW_TDM-Windows
rm -f "build/Debug/MinGW_TDM-Windows/main.o.d"
gcc -c -g -MMD -MP -MF "build/Debug/MinGW_TDM-Windows/main.o.d" -o build/Debug/MinGW_TDM-Windows/main.o main.c
mkdir -p dist/Debug/MinGW_TDM-Windows
gcc -o dist/Debug/MinGW_TDM-Windows/c_programs build/Debug/MinGW_TDM-Windows/main.o build/Debug/MinGW_TDM-Windows/structure_union.o
build/Debug/MinGW_TDM-Windows/structure_union.o: In function `main':
F:\NetBeansProjects\C_Programs/structure_union.c:32: multiple definition of `main'
build/Debug/MinGW_TDM-Windows/main.o:F:\NetBeansProjects\C_Programs/main.c:15: first defined here
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW_TDM-Windows/c_programs.exe] Error 1
make.exe[2]: Leaving directory `/f/NetBeansProjects/C_Programs'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/f/NetBeansProjects/C_Programs'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 657ms)
can somebody help me with what im doing wrong?
You have multiple main() functions in your project:
[…]/structure_union.c:32: multiple definition of `main'
It seems there's one in structure_union and another one in main.c (line 15).
C allows only one definition of main(); remove one of these and it should work.

Can't run my C code in netbeans

I am trying to run simple C program in netbeans:
#include<stdio.h>
void main()
{
printf("Hello");
}
=================================================
But I'm getting following error:
cd 'C:\Users\bhatt\Documents\NetBeansProjects\CppApplication_1'
C:\cygwin64\bin\make.exe -f Makefile CONF=Debug
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/bhatt/Documents/NetBeansProjects/CppApplication_1'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/cppapplication_1.exe
make[2]: Entering directory '/cygdrive/c/Users/bhatt/Documents/NetBeansProjects/CppApplication_1'
mkdir -p build/Debug/Cygwin-Windows
rm -f "build/Debug/Cygwin-Windows/newfile.o.d"
gcc -c -g -MMD -MP -MF "build/Debug/Cygwin-Windows/newfile.o.d" -o build/Debug/Cygwin-Windows/newfile.o newfile.c
newfile.c:6:1: fatal error: opening dependency file build/Debug/Cygwin-Windows/newfile.o.d: Permission denied
}
^
compilation terminated.
nbproject/Makefile-Debug.mk:66: recipe for target 'build/Debug/Cygwin-Windows/newfile.o' failed
make[2]: *** [build/Debug/Cygwin-Windows/newfile.o] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/bhatt/Documents/NetBeansProjects/CppApplication_1'
nbproject/Makefile-Debug.mk:59: recipe for target '.build-conf' failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/bhatt/Documents/NetBeansProjects/CppApplication_1'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 956ms)
Please help urgently
here is the main problem:
newfile.c:6:1: fatal error: opening dependency file build/Debug/Cygwin-Windows/newfile.o.d: Permission denied
which means the gcc utility did not have permission to create a new file in the directory: build/Debug/Cygwin-Windows/

Linux Cross compile Library

I try to use Linaro to cross compile "nano-2.5.3" program for my ARM board.
my build platform is linux ubuntu 12.04. I use these commands
export PATH=$PATH:/project/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin
export CROSS_COMPILE=arm-linux-gnueabihf-
export ARCH=arm
./configure --host=arm-linux-gnueabihf --prefix=/project/nano
every thing went well then I try to use make
make
after that there is a error :
/usr/include/ncursesw/curses.h:60:34: fatal error: ncursesw/ncurses_dll.h: No such file or directory
so i compile a ncurses library with my cross compiler in path "/project/ncurses" and add the include with:
export CPPFLAGS=-I/project/ncurses/include/ncurses
and do over again. but no luck
I tried everything but the cross compiler keep checking the original path
here are the full error text:
make all-recursive
make[1]: Entering directory `/project/nano-2.5.3'
Making all in doc
make[2]: Entering directory `/project/nano-2.5.3/doc'
Making all in man
make[3]: Entering directory `/project/nano-2.5.3/doc/man'
make all-recursive
make[4]: Entering directory `/project/nano-2.5.3/doc/man'
Making all in fr
make[5]: Entering directory `/project/nano-2.5.3/doc/man/fr'
make all-am
make[6]: Entering directory `/project/nano-2.5.3/doc/man/fr'
make[6]: Nothing to be done for `all-am'.
make[6]: Leaving directory `/project/nano-2.5.3/doc/man/fr'
make[5]: Leaving directory `/project/nano-2.5.3/doc/man/fr'
make[5]: Entering directory `/project/nano-2.5.3/doc/man'
make[5]: Nothing to be done for `all-am'.
make[5]: Leaving directory `/project/nano-2.5.3/doc/man'
make[4]: Leaving directory `/project/nano-2.5.3/doc/man'
make[3]: Leaving directory `/project/nano-2.5.3/doc/man'
Making all in texinfo
make[3]: Entering directory `/project/nano-2.5.3/doc/texinfo'
make all-am
make[4]: Entering directory `/project/nano-2.5.3/doc/texinfo'
make[4]: Nothing to be done for `all-am'.
make[4]: Leaving directory `/project/nano-2.5.3/doc/texinfo'
make[3]: Leaving directory `/project/nano-2.5.3/doc/texinfo'
Making all in syntax
make[3]: Entering directory `/project/nano-2.5.3/doc/syntax'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/project/nano-2.5.3/doc/syntax'
make[3]: Entering directory `/project/nano-2.5.3/doc'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/project/nano-2.5.3/doc'
make[2]: Leaving directory `/project/nano-2.5.3/doc'
Making all in m4
make[2]: Entering directory `/project/nano-2.5.3/m4'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/project/nano-2.5.3/m4'
Making all in po
make[2]: Entering directory `/project/nano-2.5.3/po'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/project/nano-2.5.3/po'
Making all in src
make[2]: Entering directory `/project/nano-2.5.3/src'
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/project/nano/share/locale\" -DSYSCONFDIR=\"/project/nano/etc\" -I/usr/include/ncursesw -I/project/ncurses/include/ncurses -g -O2 -Wall -MT browser.o -MD -MP -MF .deps/browser.Tpo -c -o browser.o browser.c
In file included from nano.h:93:0,
from proto.h:27,
from browser.c:25:
/usr/include/ncursesw/curses.h:60:34: fatal error: ncursesw/ncurses_dll.h: No such file or directory
compilation terminated.
make[2]: *** [browser.o] Error 1
make[2]: Leaving directory `/project/nano-2.5.3/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/project/nano-2.5.3'
make: *** [all] Error 2
Found it!
the problem was from the library name similarity.
I compile "ncurses" library BUT as I search the library name is "ncursesw"!
very similar... but yet they are not.

CMake and two libs with the same name

I'm using Linux, and of course libuuid is installed.
Because of the GPL license, I'd like to use the BSD version of libuuid, which I already compiled. But when I try to link it (Codelite with CMake) it tries to link it with GPL licensed system library.
CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.11)
project(libdevino)
include_directories(
/home/clausismus/Projekte/mandarine/Software/Mandarine/libdevino/c/devino/libdevino/
/home/clausismus/Projekte/mandarine/Software/Mandarine/libdevino/c/devino/libdevino/
/home/clausismus/Projekte/mandarine/Software/Mandarine/libdevino/c/devino/libdevino/libuuid
)
# Linker options
set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} ")
# Library path
set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L\".\" -L\"./libuuid/.libs\" ")
# Define the C sources
set ( C_SRCS
djson.c
dpath.c
dconf.c
dmemory.c
)
set_source_files_properties(
${C_SRCS} PROPERTIES COMPILE_FLAGS
" -g -fPIC")
add_library(libdevino SHARED ${CXX_SRCS} ${C_SRCS})
target_link_libraries(libdevino
libuuid.a
)
Codelite-Output:
/bin/sh -c '/usr/bin/make -j4 -e -f Makefile'
----------Building project:[ libdevino - Debug ]----------
/usr/bin/make -C "libdevino" -f "libdevino.mk"
make[1]: Entering directory '/home/clausismus/Projekte/mandarine/Software/Mandarine/libdevino/c/devino/libdevino'
/usr/bin/make -C "../build"
make[2]: Entering directory '/home/clausismus/Projekte/mandarine/Software/Mandarine/libdevino/c/devino/build'
make[3]: Entering directory '/home/clausismus/Projekte/mandarine/Software/Mandarine/libdevino/c/devino/build'
make[4]: Entering directory '/home/clausismus/Projekte/mandarine/Software/Mandarine/libdevino/c/devino/build'
make[4]: Leaving directory '/home/clausismus/Projekte/mandarine/Software/Mandarine/libdevino/c/devino/build'
make[4]: Entering directory '/home/clausismus/Projekte/mandarine/Software/Mandarine/libdevino/c/devino/build'
Linking C shared library liblibdevino.so
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libuuid.a(libuuid_la-gen_uuid.o): Die Umlagerung von ü¸½ü´¥¼¶ýü²´ýµü¶³¸ý¼´ý¶ü¶¡ýý½ü´¤ýµü¶³¸ýµ¼´ü³µý ²ý£¡ý³¶ü´¥ýµü¶³¸ýµ¼´ýµü´¤±ýµü¶³¸ýµ¼´ü¶µý ´ý£¡ý³¶ýøü¸½ü´¥¼¶ýü¶¤ý ´ý£¡ý³¶ü³©ý ²ý£¡ý³¶ü¶©ý ´ý£¡ý³¶ýý³³ýýü¶¡ýý´±ýµýýµü¶³¸ý¼´ýý ý£¡ý³¶ýý¤¥ýµü¶³¸ý¥¼´ýü´¤ýµü¶³¸ý¼´ý³³ýü¶¡ýü³±ý¥¼²ý ý£¡ý³¶ýµý¤¥ýýµü¶³¸ýµ¼´ý¥½ý¹Yü ¥¥ü ¤¥ý®¦·üº¶¹©ý¬ ý´¯ü ¦½©ý©¡ü ®ü§² ü ¦¤ ý¤²ý¹¹¯ý£ ý®¶¥´ý ò¢¸§ gegen »state_fd.6108« kann nicht unter Benutzung geteilter Objekte geschehen; Rekompilieren Sie mit -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libuuid.a: error adding symbols: Ungültiger Wert
collect2: error: ld returned 1 exit status
CMakeFiles/libdevino.dir/build.make:160: recipe for target 'liblibdevino.so' failed
make[4]: *** [liblibdevino.so] Error 1
make[4]: Leaving directory '/home/clausismus/Projekte/mandarine/Software/Mandarine/libdevino/c/devino/build'
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/libdevino.dir/all' failed
make[3]: *** [CMakeFiles/libdevino.dir/all] Error 2
make[3]: Leaving directory '/home/clausismus/Projekte/mandarine/Software/Mandarine/libdevino/c/devino/build'
Makefile:76: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/home/clausismus/Projekte/mandarine/Software/Mandarine/libdevino/c/devino/build'
libdevino.mk:11: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/clausismus/Projekte/mandarine/Software/Mandarine/libdevino/c/devino/libdevino'
Makefile:4: recipe for target 'All' failed
make: *** [All] Error 2
3 errors, 0 warnings
How can I tell CMake, that it should use the BSD licensed lib ("libuuid/.libs/libuuid.a")?

How to fix this error in netbeans?

I get this error message. I tried to get the right things with CYGWIN, did I do something wrong? Do you need more information?
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/c/Users/Liam/Documents/NetBeansProjects/playing with c'
cygwin warning:
MS-DOS style path detected: build/Debug/Cygwin_4.x-Windows/hello\.d
Preferred POSIX equivalent is: build/Debug/Cygwin_4.x-Windows/hello/.d
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/playing_with_c.exe
make[2]: Entering directory `/cygdrive/c/Users/Liam/Documents/NetBeansProjects/playing with c'
mkdir -p dist/Debug/Cygwin_4.x-Windows
gcc -o dist/Debug/Cygwin_4.x-Windows/playing_with_c build/Debug/Cygwin_4.x-Windows/hello\ world.o build/Debug/Cygwin_4.x-Windows/main.o
nbproject/Makefile-Debug.mk:63: recipe for target `dist/Debug/Cygwin_4.x-Windows/playing_with_c.exe' failed
make[2]: Leaving directory `/cygdrive/c/Users/Liam/Documents/NetBeansProjects/playing with c'
nbproject/Makefile-Debug.mk:60: recipe for target `.build-conf' failed
make[1]: Leaving directory `/cygdrive/c/Users/Liam/Documents/NetBeansProjects/playing with c'
nbproject/Makefile-impl.mk:39: recipe for target `.build-impl' failed
build/Debug/Cygwin_4.x-Windows/main.o: In function `main':
/cygdrive/c/Users/Liam/Documents/NetBeansProjects/playing with c/main.c:14: multiple definition of `_main'
build/Debug/Cygwin_4.x-Windows/hello world.o:/cygdrive/c/Users/Liam/Documents/NetBeansProjects/playing with c/hello world.c:3: first defined here
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/Cygwin_4.x-Windows/playing_with_c.exe] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 3s)
You have defined the main method in multiple places: main.c:14 and at hello world.c:3.
A program can have only 1 main method.
Either remove one of those files from the project, or remove one of the main method definitions.

Resources