NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Having trouble compiling

 
Post new topic   Reply to topic    NetBeans Forums -> C/C++ Users
View previous topic :: View next topic  
Author Message
nahte42



Joined: 22 Oct 2016
Posts: 1

PostPosted: Sat Oct 22, 2016 4:15 am    Post subject: Having trouble compiling Reply with quote

Hey, so Ive been trying to make things compile and work, Ive been trying to correct paths, make sure the right files are there, this is what happens, any advice or info on what to do. Thanl you:

cd 'C:\Users\Ethan\Desktop\IDE\CppApplication_1'
C:\cygwin64\bin\make.exe -f Makefile CONF=Release
"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/Ethan/Desktop/IDE/CppApplication_1'
"/usr/bin/make" -f nbproject/Makefile-Release.mk dist/Release/Cygwin_1-Windows/cppapplication_1.exe
make[2]: Entering directory '/cygdrive/c/Users/Ethan/Desktop/IDE/CppApplication_1'
mkdir -p build/Release/Cygwin_1-Windows
rm -f "build/Release/Cygwin_1-Windows/main.o.d"
g++ -c -O2 -MMD -MP -MF "build/Release/Cygwin_1-Windows/main.o.d" -o build/Release/Cygwin_1-Windows/main.o main.cpp
mkdir -p build/Release/Cygwin_1-Windows
rm -f "build/Release/Cygwin_1-Windows/newfile.o.d"
g++ -c -O2 -MMD -MP -MF "build/Release/Cygwin_1-Windows/newfile.o.d" -o build/Release/Cygwin_1-Windows/newfile.o newfile.cpp
mkdir -p dist/Release/Cygwin_1-Windows
g++ -o dist/Release/Cygwin_1-Windows/cppapplication_1 build/Release/Cygwin_1-Windows/main.o build/Release/Cygwin_1-Windows/newfile.o
build/Release/Cygwin_1-Windows/newfile.o:newfile.cpp:(.text.startup+0x0): multiple definition of `main'
build/Release/Cygwin_1-Windows/main.o:main.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [nbproject/Makefile-Release.mk:74: dist/Release/Cygwin_1-Windows/cppapplication_1.exe] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/Ethan/Desktop/IDE/CppApplication_1'
make[1]: *** [nbproject/Makefile-Release.mk:70: .build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/Ethan/Desktop/IDE/CppApplication_1'
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2

BUILD FAILED (exit value 2, total time: 2s)
Back to top
Paulo R. Panhoto
Posted via mailing list.





PostPosted: Sat Oct 22, 2016 9:58 am    Post subject: Having trouble compiling Reply with quote

There are two files in your project that contain a function main()
newfile.cpp
main.cpp
Delete one of the main() functions.
On 22 Oct 2016 03:18, "nahte42" <address-removed ([email]address-removed[/email])> wrote:
Quote:
Hey, so Ive been trying to make things compile and work, Ive been trying to correct paths, make sure the right files are there, this is what happens, any advice or info on what to do. Thanl you:

cd 'C:\Users\Ethan\Desktop\IDE\CppApplication_1'
C:\cygwin64\bin\make.exe -f Makefile CONF=Release
"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/Ethan/Desktop/IDE/CppApplication_1'
"/usr/bin/make"  -f nbproject/Makefile-Release.mk dist/Release/Cygwin_1-Windows/cppapplication_1.exe
make[2]: Entering directory '/cygdrive/c/Users/Ethan/Desktop/IDE/CppApplication_1'
mkdir -p build/Release/Cygwin_1-Windows
rm -f "build/Release/Cygwin_1-Windows/main.o.d"
g++    -c -O2 -MMD -MP -MF "build/Release/Cygwin_1-Windows/main.o.d" -o build/Release/Cygwin_1-Windows/main.o main.cpp
mkdir -p build/Release/Cygwin_1-Windows
rm -f "build/Release/Cygwin_1-Windows/newfile.o.d"
g++    -c -O2 -MMD -MP -MF "build/Release/Cygwin_1-Windows/newfile.o.d" -o build/Release/Cygwin_1-Windows/newfile.o newfile.cpp
mkdir -p dist/Release/Cygwin_1-Windows
g++     -o dist/Release/Cygwin_1-Windows/cppapplication_1 build/Release/Cygwin_1-Windows/main.o build/Release/Cygwin_1-Windows/newfile.o
build/Release/Cygwin_1-Windows/newfile.o:newfile.cpp:(.text.startup+0x0): multiple definition of `main'
build/Release/Cygwin_1-Windows/main.o:main.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [nbproject/Makefile-Release.mk:74: dist/Release/Cygwin_1-Windows/cppapplication_1.exe] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/Ethan/Desktop/IDE/CppApplication_1'
make[1]: *** [nbproject/Makefile-Release.mk:70: .build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/Ethan/Desktop/IDE/CppApplication_1'
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2

BUILD FAILED (exit value 2, total time: 2s)




Back to top
richardsanchezzw



Joined: 15 Aug 2017
Posts: 1

PostPosted: Tue Aug 15, 2017 11:16 am    Post subject: Reply with quote

I can see what you mean, indeed! I had this problem for a while... There should be only one main function in code.

_____________________
Who want to write my paper today?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> C/C++ Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo