PDA

View Full Version : silly undefined refrence to main



quickNitin
16th November 2006, 08:30
Well i need more help!!!

I am designign a form in Qt4.1.2 dsigner.
I inherit form-class and put some more features. In the same file i am defining main() and naming this file as main.cpp;

i went through copy book stpes for compilation . It results in link time error


g++ -Wl,-rpath,/usr/local/Trolltech/Qt-4.1.2/lib -o Info -L/usr/local/Trolltech/Qt-4.1.2/lib -lQtGui_debug -L/home/qt-x11-opensource-src-4.1.2/lib -L/usr/X11R6/lib -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore_debug -lz -lm -ldl -lpthread
/usr/lib/gcc/i386-redhat-linux/4.0.0/../../../crt1.o(.text+0x18): In function `_start':
: undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [Info] Error 1


pro file also look good.
Is there a web link talking about all such silly novice issues.

fritz
16th November 2006, 08:53
can you show the source code, please?

quickNitin
16th November 2006, 09:32
I have done some modification to make my code work , its doing . What iremeber is i was inheriting class generated by uic and puting sme more operations. then typical main where this error was resulting.

i found , even if i am creating a dialog in designer it still do not inherit from QDialog class. Ihave to make a object to pass to setupUi(). Is it normal.
Also i am following following steps for compilation
1. qmake -project
2. qmake
3. make

but qmake donot detects ui file and convert to equivalent .h but it shows entry for it in pro file.

jpn
16th November 2006, 09:41
I have done some modification to make my code work , its doing . What iremeber is i was inheriting class generated by uic and puting sme more operations. then typical main where this error was resulting.

i found , even if i am creating a dialog in designer it still do not inherit from QDialog class. Ihave to make a object to pass to setupUi(). Is it normal.
The class generated by uic is not a widget. It's just a class for creating the designed ui for the given widget. I strongly suggest you to read this doc: Using a Component in Your Application (http://doc.trolltech.com/4.2/designer-using-a-component.html)