BUILD FAILED (exit value 2, total time: 947ms) in netbeans

2.2k Views Asked by At

The sample code

#include <cstdlib>
#include <iostream>

using namespace std;

/*
 * 
 */
int main() {
    cout<<"hello";
    return 0;
}

error generated in the netbeans ide

    "/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/cppapplication_1.exe
make[2]: Entering directory '/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1'
mkdir -p dist/Debug/Cygwin-Windows
g++     -o dist/Debug/Cygwin-Windows/cppapplication_1 build/Debug/Cygwin-Windows/main.o build/Debug/Cygwin-Windows/newfile.o 
build/Debug/Cygwin-Windows/newfile.o: In function `main':
/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1/newfile.cpp:4: multiple definition of `main'
build/Debug/Cygwin-Windows/main.o:/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1/main.cpp:16: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [nbproject/Makefile-Debug.mk:64: dist/Debug/Cygwin-Windows/cppapplication_1.exe] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1'
make[1]: *** [nbproject/Makefile-Debug.mk:60: .build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1'
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2

BUILD FAILED (exit value 2, total time: 802ms)

I am not sure what went wrong but could not fix this issue and checked all the available solutions but still, it's there.

0

There are 0 best solutions below