Z
Z
Zempik2016-10-11 18:41:45
Programming
Zempik, 2016-10-11 18:41:45

Why error in netbeans c++?

Good evening. Netbeans 8.2, MinGW compiler.
I compile the code:

#include <iostream>
using namespace std;
int main() {
    int a;
    cout << "input a" << endl;
    cin >> a;
    cout << "Answer a = " << a;
}

Gives an error message:
cd 'C:\Users\Zem\Documents\netbeans_project\cpp_love'
C:\MinGW\msys\1.0\bin\make.exe -f Makefile CONF=Debug
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Users/Zem/Documents/netbeans_project/cpp_love'
"/C/MinGW/msys/1.0/bin/make.exe"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/cpp_love.exe
make.exe[2]: Entering directory `/c/Users/Zem/Documents/netbeans_project/cpp_love'
mkdir -p build/Debug/MinGW-Windows
rm -f "build/Debug/MinGW-Windows/test.o.d"
g++    -c -g -MMD -MP -MF "build/Debug/MinGW-Windows/test.o.d" -o build/Debug/MinGW-Windows/test.o test.cpp
mkdir -p dist/Debug/MinGW-Windows
g++     -o dist/Debug/MinGW-Windows/cpp_love build/Debug/MinGW-Windows/_ext/946084c6/hello.o build/Debug/MinGW-Windows/_ext/946084c6/int_float.o build/Debug/MinGW-Windows/test.o 
build/Debug/MinGW-Windows/_ext/946084c6/int_float.o: In function `main':
C:\Users\Zem\Documents\netbeans_project\cpp_love/../../../Dropbox/cpp_love/jni/int_float.cpp:5: multiple definition of `main'
build/Debug/MinGW-Windows/_ext/946084c6/hello.o:C:\Users\Zem\Documents\netbeans_project\cpp_love/../../../Dropbox/cpp_love/jni/hello.cpp:6: first defined here
build/Debug/MinGW-Windows/test.o: In function `main':
C:\Users\Zem\Documents\netbeans_project\cpp_love/test.cpp:3: multiple definition of `main'
build/Debug/MinGW-Windows/_ext/946084c6/hello.o:C:\Users\Zem\Documents\netbeans_project\cpp_love/../../../Dropbox/cpp_love/jni/hello.cpp:6: first defined here
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/cpp_love.exe] Error 1
make.exe[2]: Leaving directory `/c/Users/Zem/Documents/netbeans_project/cpp_love'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/Zem/Documents/netbeans_project/cpp_love'
make.exe": *** [.build-impl] Error 2

СОБРАТЬ FAILED (значение выхода 2,, общее время: 2s)

What's wrong? How to be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mercury13, 2016-10-11
@Zempik

В одном проекте два CPP-файла: int_float.cpp и hello.cpp. В обоих по main’у.
Я не знаю, как NB объединяет файлы в проект, но если всё, что в каталоге и подкаталогах — значит, не держи где-то в подкаталогах другой проект.
Второй вариант — очистить временный каталог с .o-файлами; там, возможно, завалялось что-то старое.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question