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/
Related
I was compiling and building simple kernel module on linux
following is my Makefile
obj-m := hello-1.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
rm -rf *.o *.ko *.mod.* *.symvers *.order
when I run make command against the makefile I get error that mkmakefile missing
make[1]: Entering directory '/usr/src/linux-headers-5.9.0-kali2-amd64'
sh: 0: cannot open /usr/src/linux-headers-5.9.0-kali2-common/scripts/mkmakefile: No such file
make[3]: *** [/usr/src/linux-headers-5.9.0-kali2-common/Makefile:552: outputmakefile] Error 2
/usr/src/linux-headers-5.9.0-kali2-common/Makefile:691: include/config/auto.conf.cmd: No such file or directory
make[2]: *** [/usr/src/linux-headers-5.9.0-kali2-common/Makefile:710: include/config/auto.conf.cmd] Error 2
make[1]: *** [/usr/src/linux-headers-5.9.0-kali2-common/Makefile:185: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.9.0-kali2-amd64'
enter code here
make: *** [Makefile:6: default] Error 2
the from this page https://forums.kali.org/showthread.php?46712-Kali-2020-1-VMWARE-installing-Alfa-AWUS036ACM
i changed my make file following line
default:
$(MAKE) -C $(KDIR) M=$(PWD) modules
Now it's giving different error that auto.conf is missing
make -C /lib/modules/5.9.0-kali2-amd64/build M=/home/fawad/Desktop/infoFolder/Linux/KernelDevelopment/hell modules
make[1]: Entering directory '/usr/src/linux-headers-5.9.0-kali2-amd64'
ERROR: Kernel configuration is invalid.
include/generated/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
make[2]: *** [/usr/src/linux-headers-5.9.0-kali2-common/Makefile:718: include/config/auto.conf] Error 1
make[1]: *** [/usr/src/linux-headers-5.9.0-kali2-common/Makefile:185: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.9.0-kali2-amd64'
make: *** [Makefile:6: default] Error 2
I found on internet I have to run make prepare command against Makefile in /usr/src/linux-headers-5.9.0-kali2-common/Makefilebut now its again giving me an first error
sh: 0: cannot open /usr/src/linux-headers-5.9.0-kali4-common/scripts/mkmakefile: No such file
/usr/src/linux-headers-5.9.0-kali4-common/Makefile:691: include/config/auto.conf.cmd: No such file or directory
make[1]: *** [/usr/src/linux-headers-5.9.0-kali4-common/Makefile:710: include/config/auto.conf.cmd] Error 2
make: *** [/usr/src/linux-headers-5.9.0-kali4-common/Makefile:185: __sub-make] Error 2
I like to know how to configure make and linux so I can build external modules? like this one
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
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.
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")?
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)
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.