Welcome! Log In Create A New Profile

Advanced

collect: id returned 1 exit status error

Posted by Anonymous User 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Anonymous User
collect: id returned 1 exit status error
September 22, 2010 11:26AM
Can one genius out there knock out this error out of my problems? I tried all kinds of tricks but could not get this fixed. From installing different visions of Qt4 to clearing previous installed MinGW. Most of the examples on Ezust end up giving me this error. Let’s take example 11.5 dialogs.cpp.
I get same error



Running build steps for project firstdia...
Configuration unchanged, skipping qmake step.
Starting: "C:/Qt/2010.04/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/unisa/COS214/firstdia-build-desktop'
C:/Qt/2010.04/mingw/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/unisa/COS214/firstdia-build-desktop'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o release\firstdia.exe release/dialogs.o -L"c:\Qt\2010.04\qt\lib" -lmingw32 -lqtmain -lQtGui4 -lQtCore4
release/dialogs.o:dialogs.cppsad smiley.text+0x2d): undefined reference to `vtable for Dialogs'
release/dialogs.o:dialogs.cppsad smiley.text+0x34): undefined reference to `vtable for Dialogs'
release/dialogs.o:dialogs.cppsad smiley.text+0x113): undefined reference to `Dialogs::staticMetaObject'
release/dialogs.o:dialogs.cppsad smiley.text+0x1bb): undefined reference to `Dialogs::staticMetaObject'
release/dialogs.o:dialogs.cppsad smiley.text+0x451): undefined reference to `vtable for Dialogs'
release/dialogs.o:dialogs.cppsad smiley.text+0x458): undefined reference to `vtable for Dialogs'
release/dialogs.o:dialogs.cppsad smiley.text+0x537): undefined reference to `Dialogs::staticMetaObject'
mingw32-make[1]: Leaving directory `C:/unisa/COS214/firstdia-build-desktop'
mingw32-make: Leaving directory `C:/unisa/COS214/firstdia-build-desktop'
release/dialogs.o:dialogs.cppsad smiley.text+0x5df): undefined reference to `Dialogs::staticMetaObject'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\firstdia.exe] Error 1
mingw32-make: *** [release] Error 2
The process "C:/Qt/2010.04/mingw/bin/mingw32-make.exe" exited with code %2.[/[/b]b]
Error while building project firstdia (target: Desktop)
When executing build step ''
avatar Re: collect: id returned 1 exit status error
September 22, 2010 04:58PM
Those errors look like the things created by the Q_OBJECT macro and the MOC. Make sure that moc_dialogs.cpp is being included in the linker step.
Anonymous User
Re: collect: id returned 1 exit status error
September 22, 2010 08:54PM
thanks Robanaurochs, you wrote " Make sure that the moc_dialogs.cpp is being included in the linker step" I will appreciate if you elaborate more. I know you don't want to spoon feed me but i'm still learning learning how to walk in this QT4 thing. How do I do that?
avatar Re: collect: id returned 1 exit status error
September 22, 2010 09:04PM
smile
Don't you just have the wrong kind of smiley after each dot-cpp?


Sorry...

um.. OK I can offer some "stupid (as opposed to genius - all the genii are hibernating at the moment) help" here, then in recompense. The class Dialogs is not on your path? (If it was, then surely all its members would be available?) So then maybe look for a directory containing Dialogs.h ? Then make sure that one's on your path?

Shot in the dark ...
avatar Re: collect: id returned 1 exit status error
September 22, 2010 09:27PM
I don't use MinGW but I seem to recall the process is to create the project file by running
qmake -project
. After this, you need to generate the Makefile that contains all the instructions that MinGW needs.
qmake
. All that's necessary now is to do the actual compile and linkage.
make
.

I've just imported the files into my QCreator and ran qmake to generate the Makefile. Excuse the differences in file paths since I'm running on Ubuntu and you're on Windows, the process is analogous. the relevant lines you should check to see if they're present are:

####### Files

SOURCES       = ../test/dialogs.cpp moc_dialogs.cpp      <<<<<<<< This line tells make which files to compile
OBJECTS       = dialogs.o \
		moc_dialogs.o                            <<<<<<<< This line tells the linker which files to link together (along with system libraries) to make the final executable
compiler_moc_header_make_all: moc_dialogs.cpp                                                          <<<<<<<< This line gives the name of the file to be generated by MOC
moc_dialogs.cpp: ../test/dialogs.h
	/opt/Qt/qtsdk-2010.04/qt/bin/moc $(DEFINES) $(INCPATH) ../test/dialogs.h -o moc_dialogs.cpp    <<<<<<<<< This is the actuall running of MOC (input dialogs.h, output moc_dialogs.cpp)
####### Compile

dialogs.o: ../test/dialogs.cpp ../test/dialogs.h
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o dialogs.o ../test/dialogs.cpp        <<<<<<<<< The compiling instructions for dialogs.cpp

moc_dialogs.o: moc_dialogs.cpp 
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_dialogs.o moc_dialogs.cpp        <<<<<<<<< The compiling instructions for moc_dialogs.cpp


Now, aren't you glad that we don't have to create the Makefiles ourselves. winking smiley
avatar Re: collect: id returned 1 exit status error
September 22, 2010 09:40PM
@slow_eddy
It's not a path error here. If there was a problem finding Dialogs.h, there would be a precompiler error very early on. The mere fact that dialogs.o exists means that the compiler has finished it's job successfully and created the object file for the linker.

Another clue to the problem is the error message itself: undefined reference to

These kinds of error messages are only generated by the linker when it's trying to put all the pieces together. What it means is that it's found a reference to a certain function being used on one object file and finished processing all the other object files and static libraries without finding the body of the function being referenced.

If you ignore the vtable error messages and look at Dialogs::staticMetaObject, this gives the most likely cause of the error. This particular function is generated by MOC and should be compiled and linked into the executable from moc_dialogs.cpp.
Anonymous User
Re: collect: id returned 1 exit status error
September 23, 2010 08:23AM
deep down in my heart when I said genius I knew I was refering to you two. Slow eddy, Dialogs.h is in the project directory, else I would have got an explanatory error. this is definately a linker problem. I will look at robanaurochs suggestions. lot of appreciations for your help

@ Eddy. I don't know how those smiley got in there. I gues the computer saw how unhappy I was while pasting those errors
avatar Re: collect: id returned 1 exit status error
September 23, 2010 11:22AM
grinning smiley

Well you'll be thrilled to know I've learnt something from your post.
Anonymous User
Re: collect: id returned 1 exit status error
September 23, 2010 11:38AM
Oops. both of you were correct. MOC was unable to preprocess the header file. Slow eddy was spot on, for the MOC to preprocess dialogs.h,I just included dialogs.h in the HEADERS variable of the the .pro file. Thank you very much. you guys are the reason this forum is still alive. without you, I wonder if people will be coming here.
avatar Re: collect: id returned 1 exit status error
September 23, 2010 12:46PM
Very kind words, crunx, but please take everything I say with a bag or two of salt. I'm no expert (and the examiners seem to agree). Pay more heed to eg. robanaurochs.
Anonymous User
Re: collect: id returned 1 exit status error
September 23, 2010 01:48PM
lol @ I'm no expert (and the examiners seem to agree)
avatar Re: collect: id returned 1 exit status error
September 23, 2010 01:56PM
Now I think I'm going to cry ...
smile

No, I'll save that till after these exams.
Sorry, only registered users may post in this forum.

Click here to login