need help.. QT DESIGNER (tutorial: something is wrong)
i writed METRIC CONVERSION in QT DESIGNER now:
[root@localhost METRIC]# qmake [root@localhost METRIC]# make /bin/uic conversionform.ui -o .ui/conversionform.h g++ -c -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -DQT_NO_DEBUG -I/usr/lib/qt3//mkspecs/default -I. -I/include -I.ui/ -I.moc/ -o .obj/main.o main.cpp main.cpp:1:26: qapplication.h: No such file or directory In file included from main.cpp:2: conversionform.ui.h:2: syntax error before `.' token conversionform.ui.h:27: `numberLineEdit' was not declared in this scope conversionform.ui.h:31: parse error before `switch' conversionform.ui.h:46: parse error before `switch' conversionform.ui.h:59: `decimalsSpinBox' was not declared in this scope conversionform.ui.h:60: syntax error before `->' token conversionform.ui.h:61: syntax error before `->' token In file included from main.cpp:2: conversionform.ui.h:64:25: qvalidator.h: No such file or directory conversionform.ui.h:66: syntax error before `::' token conversionform.ui.h:69: syntax error before `->' token conversionform.ui.h:70: ISO C++ forbids declaration of `convert' with no type conversionform.ui.h:71: syntax error before `->' token main.cpp: In function `int main(int, char**)': main.cpp:6: `QApplication' undeclared (first use this function) main.cpp:6: (Each undeclared identifier is reported only once for each function it appears in.) main.cpp:6: parse error before `(' token main.cpp:7: `ConversionForm' undeclared (first use this function) main.cpp:8: `w' undeclared (first use this function) main.cpp:9: `a' undeclared (first use this function) main.cpp:9: `lastWindowClosed' undeclared (first use this function) main.cpp:9: `SIGNAL' undeclared (first use this function) main.cpp:9: `quit' undeclared (first use this function) main.cpp:9: `SLOT' undeclared (first use this function) main.cpp:5: warning: unused parameter `int argc' main.cpp:5: warning: unused parameter `char**argv' make: *** [.obj/main.o] Błąd 1 błąd=error why its not working? :(( |
my "conversionform.ui.h" file:
**************************************************************************** ** ui.h extension file, included from the uic-generated form implementation. ** ** If you wish to add, delete or rename functions or slots use ** Qt Designer which will update this file, preserving your code. Create an ** init() function in place of a constructor, and a destroy() function in ** place of a destructor. *****************************************************************************/ void ConversionForm::convert() { enum MetricUnits { Kilometers, Meters, Centimeters, Millimeters }; enum OldUnits { Miles, Yards, Feet, Inches }; // Retrieve the input double input = numberLineEdit->text().toDouble(); double scaledInput = input; // internally convert the input to millimeters switch ( fromComboBox->currentItem() ) { case Kilometers: scaledInput *= 1000000; break; case Meters: scaledInput *= 1000; break; case Centimeters: scaledInput *= 10; break; } //convert to inches double result = scaledInput * 0.0393701; switch ( toComboBox->currentItem() ) { case Miles: result /= 63360; break; case Yards: result /= 36; break; case Feet: result /= 12; break; } // set the result int decimals = decimalsSpinBox->value(); resultLineEdit->setText( QString::number( result, 'f', decimals ) ); numberLineEdit->setText( QString::number( input, 'f', decimals ) ); } #include <qvalidator.h> void ConversionForm::init() { numberLineEdit->setValidator( new QDoubleValidator( numberLineEdit ) ); numberLineEdit->setText( "10" ); convert(); numberLineEdit->selectAll(); } |
I think maybe the first error to deal with would be:
"main.cpp:1:26: qapplication.h: No such file or directory" what does that part of your main.cpp look like? |
main.cpp file:
#include <qapplication.h> #include "conversionform.ui.h" int main( int argc, char ** argv ) { QApplication a( argc, argv ); ConversionForm w; w.show(); a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); return a.exec(); } i havent write there anything... its self-generated... i was following first tutorial ("quick start") |
i have done already twice that tutorial and its still not working... :((
|
that says you do not have qapplication.h do you have the qt development packages installed?
|
hmmm... i have:
libqt3-devel-3.1.1-13mdk |
hmmm can some1 make that tutorial in QT designer and send files to me... maybe i do somethng wrong.... pls help me lear QT...
my mail: kolek.hunter@interia.pl |
Sorry for the delay, but I just wanted to say that I agree with Nakkaya up there.
The error points to the compiler not being able to find qapplication.h I see you have libqt3-devel installed, but I think (my memory sucks) that there is also another qt3-devel package to install I see you're using Mdk9.1 so if URPMI is set up (search the forum for some great instructions on how to do it if it isn't) then just do: URPMI --fuzzy qt and you'll get a list of all the packages with 'qt' in the name (warning: It could be a LOT) and from that list, install all the qt-devel packages you haven't installed. If they are all installed, let me know and we'll dig some more. |
ehh i tryed to "update" and i see: "there is no update packages avible or u have updated all"
grr FUCK MANDRAKE!! i hate it! whatever i want to do i se fucked ERRORSSS... grrrr i`m going to install GENTOO... maybe there something will work... i will get my gentoo copy in few days... cya.. thx 4trying to help mi with stupid mandrake |
Hey, if you want to switch to Gentoo I won't stop you. However, I will note that what is happening is not Mandrake's fault.
Why are you trying to "Update" anything? Did you try the fuzzy search to see if you're actually missing a package? This seems likely, and if you are missing a package, then the update function won't do anything for that since you don't have it in the first place... Something else you may want to try from the command line: locate qapplication.h see if it finds it. As I said, you can switch to Gentoo, that's fine, its a fine distro..but the problem you are experiencing is not a "distro" specific problem per-say |
i had the same problem..found this and it fixed the problem
http://lists.arabeyes.org/archives/d.../msg00005.html "it's a common problem by mandrake 9.x. Create a link named libqt.so to > libqt-mt.so.x.x.x and place the text below to your .bash_profile" > > QMAKESPEC=/usr/lib/qt3/mkspecs/linux-g++ > export QMAKESPEC > > QTDIR=/usr/lib/qt3 > PATH=$QTDIR/bin:$PATH > MANPATH=$QTDIR/doc/man:$MANPATH > LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH > export QTDIR PATH MANPATH LD_LIBRARY_PATH > > PATH=$PATH:$HOME/bin:/usr/local/bin:/usr/lib/qt3/bin/ > |
I am also having problems with this project. My main.cpp is identical to the one posted above. It's probably something silly as it's been several years since I programmed. However, all the code was generated by QT Designer installed with Mdk 9.1. I have already added the above suggested lines to .bash_profile. The only alteration to the code below that I have made is to make the comment lines into C++ comments with '//'.
TIA Michael wn5t [at] arrl.net Here is the list of errors I get after issuing the command >make : conversionform.ui.h:11: ISO C++ forbids declaration of `CC' with no type conversionform.ui.h:12: `gcc' was not declared in this scope conversionform.ui.h:12: parse error before `=' token conversionform.ui.h:29: invalid suffix on integer constant conversionform.ui.h:66: parse error before `@' token conversionform.ui.h:69: parse error before `@' token conversionform.ui.h:72: parse error before `@' token conversionform.ui.h:75: parse error before `@' token conversionform.ui.h:78: parse error before `@' token conversionform.ui.h:90: `MAKE' was not declared in this scope conversionform.ui.h:90: ISO C++ forbids declaration of `$' with no type conversionform.ui.h:90: syntax error before `)' token conversionform.ui.h:95: parse error before `@' token conversionform.ui.h:98: parse error before `@' token main.cpp:7: 'ConversionForm' is used as a type, but is not defined as a type. main.cpp:8: syntax error before `.' token main.cpp:9: syntax error before `.' token Here is the code for conversionform.ui: //############################################################################# //# Makefile for building: metric //# Generated by qmake (1.04a) (Qt 3.1.1) on: Tue Dec 2 06:28:50 2003 //# Project: metric.pro //# Template: app //# Command: $(QMAKE) -o Makefile metric.pro //############################################################################# //####### Compiler, tools and options //CONFIG += thread CC = gcc CXX = g++ LEX = flex YACC = yacc CFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -DQT_NO_DEBUG CXXFLAGS = -pipe -Wall -W -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -DQT_NO_DEBUG LEXFLAGS = YACCFLAGS= -d INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -I /usr/lib/qt3/include -I.ui/ -I.moc/ LINK = g++ LFLAGS = LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt -lXext -lX11 -lm AR = ar cqs RANLIB = MOC = $(QTDIR)/bin/moc UIC = $(QTDIR)/bin/uic QMAKE = qmake TAR = tar -cf GZIP = gzip -9f COPY = cp -f COPY_FILE= $(COPY) -p COPY_DIR = $(COPY) -pR DEL_FILE = rm -f SYMLINK = ln -sf DEL_DIR = rmdir MOVE = mv -f CHK_DIR_EXISTS= test -d MKDIR = mkdir -p //####### Output directory OBJECTS_DIR = .obj/ //####### Files HEADERS = SOURCES = main.cpp OBJECTS = .obj/main.o \ .obj/conversionform.o FORMS = conversionform.ui UICDECLS = .ui/conversionform.h UICIMPLS = .ui/conversionform.cpp SRCMOC = .moc/moc_conversionform.cpp OBJMOC = .obj/moc_conversionform.o DIST = metric.pro QMAKE_TARGET = metric DESTDIR = TARGET = metric first: all //####### Implicit rules .SUFFIXES: .c .cpp .cc .cxx .C .cpp.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .cc.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .cxx.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .C.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .c.o: $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< //####### Build rules all: Makefile $(TARGET) $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) mocables: $(SRCMOC) $(MOC): ( cd $(QTDIR)/src/moc ; $(MAKE) ) Makefile: metric.pro /usr/lib/qt3/mkspecs/default/qmake.conf $(QMAKE) -o Makefile metric.pro qmake: @$(QMAKE) -o Makefile metric.pro dist: @mkdir -p .obj/metric && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .obj/metric/ && $(COPY_FILE) --parents conversionform.ui.h .obj/metric/ && ( cd dirname .obj/metric && $(TAR) metric.tar metric && $(GZIP) metric.tar ) && $(MOVE) dirname .obj/metric/metric.tar.gz . && $(DEL_FILE) -r .obj/metric mocclean: -$(DEL_FILE) $(OBJMOC) -$(DEL_FILE) $(SRCMOC) uiclean: -$(DEL_FILE) $(UICIMPLS) $(UICDECLS) yaccclean: lexclean: clean: mocclean uiclean -$(DEL_FILE) $(OBJECTS) -$(DEL_FILE) *~ core *.core //####### Sub-libraries distclean: clean -$(DEL_FILE) $(TARGET) $(TARGET) FORCE: //####### Compile .obj/main.o: main.cpp .ui/conversionform.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/main.o main.cpp .ui/conversionform.h: conversionform.ui $(UIC) conversionform.ui -o .ui/conversionform.h .ui/conversionform.cpp: .ui/conversionform.h conversionform.ui $(UIC) conversionform.ui -i conversionform.h -o .ui/conversionform.cpp .obj/conversionform.o: .ui/conversionform.cpp conversionform.ui.h \ .ui/conversionform.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/conversionform.o .ui/conversionform.cpp .obj/moc_conversionform.o: .moc/moc_conversionform.cpp .ui/conversionform.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_conversionform.o .moc/moc_conversionform.cpp .moc/moc_conversionform.cpp: $(MOC) .ui/conversionform.h $(MOC) .ui/conversionform.h -o .moc/moc_conversionform.cpp //####### Install install: all uninstall: |
Try gmake
I had problems with this as well. My error messages were a little different. My computer wouldn't even recognize the qmake. I performed a locate on qmake and then ran the command from inside its directory and it still had problems. Then for some unexplained reason I typed in locate gmake by mistake and and then ran gmake. it did everything all at once and the program runs great.
|
I had the same error problem : "numberlineEdit not declared in this scope" and the like. I solved this problem by manually editing the .ui generated file and the .ui.h file. The problem is C++ is case sensitive compiler. I just change the case of each variable in .ui file match exactly with variable in .ui.h file. Copy paste code from help file sometime can lead to this case sensitivity problem. It's better to write it by hand.
|
All times are GMT -5. The time now is 03:04 PM. |