1 Error + need an advice from you guys
-
@Project try, take a look to "qt5-book-code":https://github.com/mutse/qt5-book-code it could be useful for continue learning
-
@qxoz thanks , I'll check them out.
I'm sorry for posting late guys , I had to sleep + go to college :(
anyways when I installed qt it came with it a command prompt , when I opened it and wrote qmake it says you can place any variable assigement in option will be parsed and there's some option like -o file
i don't know what to do , I'm new to this , usually I just run the compiler and it just works.
-
Hey guys , I've gone to folder that the project is in " from command line that came with qt " and used qmake but it justs doesn't show anything , when I tried to compile it from qt creator it gives me the same error ?
maybe because I used qmake in the project ? theree's two folders when I create a new project , one is for the project files and the other is called build ....
-
I guess nothing worked :(
1- tried using qmake in the command line , didn't work
2- cleaned the project then ran qmake and build it and it did not work
3- used a new project and it did not workit just gives the same error and it says nameoffile.obj not found " the same error "
-
Windows is not especially user/developer friendly on the command line.
Where did you call qmake ? Did you call nmake afterwards ?
-
I called qmake in the command line , also in the project " when you right click " you'll find an option called " qmake " , what is nmake ? becaus when I tried it in the command line it says there's no such thing.
-
nmake is the command that will read the Makefiles generated by qmake and call the compiler/linker etc…
But I am just realizing… What version of Qt is installed ? VSXXXX or MinGW ? If the later, you need to call mingw32-make after qmake
-
Sorry for posting late , I have the qt 5.2.1 ( msvc 2010 , 32bit) if this is what you're looking for .. the creator is 3.0.1
-
Are you sure you are using the correct command line ?
Before taking too much time with it, does Qt Creator work correctly when building a default created application ? (using file -> new project -> use all defaults -> build )
-
Yes it works fine with the default building , it shows the main window just fine , as I said when I remove q_object the problem goes away , not sure why.
sorry for wasting your time with me :(
-
Let me just post the code here so you can check ^^
the interface for the class:
@#ifndef FINDDIALONG_H
#define FINDDIALONG_H
#include<QDialog>class QCheckBox;
class QLabel;
class QLineEdit;
class QPushButton;class Finddialong : public QDialog
{
Q_OBJECT
public:
Finddialong(QWidget *parent=0);
signals:
void findNext(const QString &str,Qt::CaseSensitivity cs);
void findPrevious(const QString &str,Qt::CaseSensitivity cs);
private slots:
void findClicked();
void enablefindButton(const QString &text);
private:
QLabel *label;
QLineEdit *lineEdit;
QCheckBox *backwardCheckBox;
QCheckBox *caseCheckBox;
QPushButton *findButton;
QPushButton *closeButton;
};#endif // FINDDIALONG_H
@the implement for the class:
@#include<QtGui>
#include "finddialong.h"
#include<QHBoxLayout>
#include<QVBoxLayout>
#include<QPushButton>
#include<QLabel>
#include<QLineEdit>
#include<QCheckBox>Finddialong::Finddialong(QWidget *parent) : QDialog(parent)
{
label=new QLabel(tr("Find &what:"));
lineEdit = new QLineEdit;
label->setBuddy(lineEdit);
caseCheckBox=new QCheckBox(tr("Match &case"));
backwardCheckBox=new QCheckBox(tr("Search &backward"));
findButton=new QPushButton(tr("&Find"));
findButton->autoDefault();
findButton->setEnabled(false);
closeButton = new QPushButton(tr("close"));
connect(lineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(enableFindButton(const QString &)));
connect(findButton,SIGNAL(clicked()),this,SLOT(findClicked()));
connect(closeButton,SIGNAL(clicked()),this,SLOT(close()));
QHBoxLayout *topLeftLayout=new QHBoxLayout;
topLeftLayout->addWidget(label);
topLeftLayout->addWidget(lineEdit);
QVBoxLayout *LeftLayout=new QVBoxLayout;
LeftLayout->addLayout(topLeftLayout);
LeftLayout->addWidget(backwardCheckBox);
LeftLayout->addWidget(caseCheckBox);
QVBoxLayout *rightLayout=new QVBoxLayout;
rightLayout->addWidget(findButton);
rightLayout->addWidget(closeButton);
rightLayout->addStretch();
QHBoxLayout *mainLayout=new QHBoxLayout;
mainLayout->addLayout(LeftLayout);
mainLayout->addLayout(rightLayout);
setLayout(mainLayout);}@
-
Then, did you try to call qmake "Run qmake" from the "Build" menu of Qt Creator ?
-
Yes :( same problem
-
Also with a "Rebuild All" ?
@#include <QtGui> << bad habit only include what you use@
-
yes I rebuild it all , if you can try the class and see what happens pls :(
also about the qtgui in the book it says include it , but what does it do ? it says it contains two files.
-
You are missing the implementation of both your slots. Once you add that you should be able to compile it.
It's called a "module include". It will include everything from the module. You don't want your compiler to go through all of that when building an application (it can be ok for a quick prototyping but that's all)
-
Oh , thanks man , I just like to compile it once in a while so i won't get lots of errors after finishing .
by the way what does the qt gui contain ?
-
The GUI stuff that are not widget related so you can e.g. create a GUI using only OpenGL without pulling in the widgets
-
Is learning it right now going to benefit me as a beginner ?
Also if I might ask , what's the best way to learn qt ? because I read this book and it contains lots of examples " including this one " which is not finished yet, in c++ standards I just learn the idea and then I know how to use it , but in qt it contains lost of classes and functions and I don't know how to remember them all :( , is the hardest part remembering them and knowing how to use them ?
-
Hi,
[quote author="Project try" date="1393890019"]Is learning it right now going to benefit me as a beginner ?[/quote]The classes/functions Qt GUI module are more for developers who want to implement custom graphics. I'd recommend sticking to ready-made widgets for now.
Note: In Qt 4, all widgets are part of the Qt GUI module. In Qt 5, they were moved into a separate Qt Widgets module. Keep this in mind when you read through your Qt 4 book. (Most things are still compatible between Qt 4 and Qt 5, but there are small differences to look out for)
[quote]Also if I might ask , what's the best way to learn qt ? because I read this book and it contains lots of examples " including this one " which is not finished yet, in c++ standards I just learn the idea and then I know how to use it , but in qt it contains lost of classes and functions and I don't know how to remember them all :( , is the hardest part remembering them and knowing how to use them ? [/quote]First, I recommend working inside Qt Creator, rather than the command line. Qt Creator takes care of lots of behind-the-scenes config for you, so that you can focus on coding.
Second, Qt is a very large framework/library. You can see all of Qt's modules here: http://qt-project.org/doc/qt-5/qtmodules.html -- I daresay most developers don't remember everything either. We simply remember the parts that we use most, and then search the documentation and/or ask in this forum when we want to do something that we don't know how to.
Third, I think the best way to learn Qt (and all frameworks in general) is to create little toy projects that you can interact with. The tutorials in your book should be good.
This is the official tutorial which is good too: http://doc-snapshot.qt-project.org/qt5-stable/gettingstartedqt.html It takes you through a small project from start to finish, explaining every little step. (You can ignore the XML parts though -- just focus on the C++ code)
[quote]when I remove q_object the problem goes away , not sure why.[/quote]The problem doesn't go away; it's just replaced by a different problem that shows up later. Without Q_OBJECT, your signals and slots cannot connect.