LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-09-2003, 02:38 PM   #1
hunter_one
Member
 
Registered: Jun 2003
Distribution: mdk 9.1 , gentoo
Posts: 101

Rep: Reputation: 15
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? (
 
Old 09-09-2003, 02:45 PM   #2
hunter_one
Member
 
Registered: Jun 2003
Distribution: mdk 9.1 , gentoo
Posts: 101

Original Poster
Rep: Reputation: 15
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();
}
 
Old 09-09-2003, 02:52 PM   #3
tcaptain
LQ Addict
 
Registered: Jul 2002
Location: Montreal
Distribution: Gentoo 2004 from stage 1 baby!
Posts: 1,403

Rep: Reputation: 45
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?
 
Old 09-09-2003, 03:43 PM   #4
hunter_one
Member
 
Registered: Jun 2003
Distribution: mdk 9.1 , gentoo
Posts: 101

Original Poster
Rep: Reputation: 15
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")
 
Old 09-09-2003, 04:35 PM   #5
hunter_one
Member
 
Registered: Jun 2003
Distribution: mdk 9.1 , gentoo
Posts: 101

Original Poster
Rep: Reputation: 15
i have done already twice that tutorial and its still not working... (
 
Old 09-09-2003, 06:25 PM   #6
nakkaya
LQ Guru
 
Registered: Jan 2003
Location: Turkey&USA
Distribution: Emacs and linux is its device driver(Slackware,redhat)
Posts: 1,398

Rep: Reputation: 45
that says you do not have qapplication.h do you have the qt development packages installed?
 
Old 09-10-2003, 10:11 AM   #7
hunter_one
Member
 
Registered: Jun 2003
Distribution: mdk 9.1 , gentoo
Posts: 101

Original Poster
Rep: Reputation: 15
hmmm... i have:

libqt3-devel-3.1.1-13mdk
 
Old 09-10-2003, 10:30 AM   #8
hunter_one
Member
 
Registered: Jun 2003
Distribution: mdk 9.1 , gentoo
Posts: 101

Original Poster
Rep: Reputation: 15
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
 
Old 09-10-2003, 11:51 AM   #9
tcaptain
LQ Addict
 
Registered: Jul 2002
Location: Montreal
Distribution: Gentoo 2004 from stage 1 baby!
Posts: 1,403

Rep: Reputation: 45
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.
 
Old 09-10-2003, 03:07 PM   #10
hunter_one
Member
 
Registered: Jun 2003
Distribution: mdk 9.1 , gentoo
Posts: 101

Original Poster
Rep: Reputation: 15
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
 
Old 09-10-2003, 08:29 PM   #11
tcaptain
LQ Addict
 
Registered: Jul 2002
Location: Montreal
Distribution: Gentoo 2004 from stage 1 baby!
Posts: 1,403

Rep: Reputation: 45
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
 
Old 09-23-2003, 07:47 PM   #12
breman
LQ Newbie
 
Registered: Aug 2003
Posts: 27

Rep: Reputation: 15
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/
>
 
Old 12-03-2003, 11:09 PM   #13
WN5T
LQ Newbie
 
Registered: Aug 2003
Posts: 1

Rep: Reputation: 0
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:
 
Old 02-16-2004, 12:43 AM   #14
tyberius
LQ Newbie
 
Registered: Feb 2004
Posts: 1

Rep: Reputation: 0
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.
 
Old 07-07-2006, 07:40 PM   #15
si_sol
LQ Newbie
 
Registered: Jul 2006
Posts: 1

Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Did tutorial on Qt designer but it still won't make matazar42 Programming 6 09-03-2005 07:05 PM
Do you use QT designer? DJOtaku Programming 6 04-24-2005 04:56 PM
Is There any online tutorial for QT Designer msramachandran Programming 1 06-02-2004 07:06 AM
qt designer help.......... nitk Linux - Software 2 10-30-2003 09:22 AM
How about a weekly tutorial? or just a tutorial Alinuxnoob LQ Suggestions & Feedback 2 04-09-2002 08:30 PM


All times are GMT -5. The time now is 03:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration