PDA

View Full Version : A build problem in Qt creator 1



Dante
12th March 2009, 14:29
Hi pals
I just installed Qt on windows XP and to become familiar with the details of Qt creator c++ programming, I wrote this code:

#include "test.h"
#include <conio.h>
#include <iostream.h>
void main(){
int x;
cin>>x;
cout<<x*x;
getch();}
but when i clicked on build menu,all icons were disabled.I saved the file but there was still no answer.
and one more thing.
in Qt creator code editing page,there is a wavy line under the #include lines.
thanks

wysota
12th March 2009, 16:21
Did you start a new project?

About the wavy lines - hover your mouse cursor over them to see what the problem is (if the line is green, it means the parser can't find the files you are trying to include).

Dante
12th March 2009, 16:36
No there is no project.
and you know,it should be able to find conio.h and iostream.h,shouldn't it?

ComaWhite
12th March 2009, 19:37
no it shouldn't find iostream.h since its been deprecated for more than 10 years iirc. and should be using #include <iostream> and #include <cconio>

wysota
12th March 2009, 20:12
No there is no project.
Then start one.

and you know,it should be able to find conio.h and iostream.h,shouldn't it?

And how should it know where to look for them if it doesn't even know where the compiler is installed and what compiler you are going to use?

Dante
13th March 2009, 11:33
So you mean it compiles just the files that are part of a project not a single source file?
and could you tell me how to set the compiler ?
and what is the error below:

:-1: error: collect2: ld returned 1 exit status
thanks

wysota
13th March 2009, 17:37
So you mean it compiles just the files that are part of a project not a single source file?

Creator is not trying to be smarter than its user, how should it know how to compile a standalone file? What if you gave it an SQL file, what should it do with it? What platform should it try to compile it for and using what compiler?


and could you tell me how to set the compiler ?
If you start a qmake project, qmake will create a proper Makefile for you. Just start a new project and the wizard will guide you.

and what is the error below:

Linker couldn't find some library it wanted to link your application against. Hard to say what the problem was, you'd have to paste the first error message, not the last one.