Creating new project from existing files
-
Hi, all -
I want to try importing a small project (currently about 10 files) into the Qt environment, so I can use tools like the Qt debugger. I'm not actually ready to use Qt's GUI stuff; I just want to get further acquainted with the environment.
With this in mind, which is the preferred way to get my files into a new project?
Thanks.
-
Is it OK if I create the project using the directory with the existing files? Or, is that going to give me a conflict between my main.cpp and the one that Qt wants to make for me?
Also, when I create a project, will it create and maintain a makefile for me?
Thanks.
-
Thanks, guys. I normally appreciate the value of exercises for the reader. If I don't get this code imported into Qt today, though, at least to where I can edit, build and do some rudimentary debugging, I may have to shelve Qt for the time and stay with the IDE that's currently giving me problems. So, for today anyway, product is more important than process.
So...is it OK if I build the project on top of a directory structure with subdirectories for source and includes? Or, is it better if I start with an empty project and import my files into it?
-
Thanks, Volker. I guess what I'm trying to get at here is, there doesn't seem to be a traditional "import" function. I can create new files, or I can add existing files (but they don't "move" into the Qt directory structure). I was hoping that if I created my Qt project on top of an existing directory structure (which currently only contains two subdirectories), Qt would magically "discover" the files, but that doesn't seem to work, either.
It's a small enough number of files that I can just create new ones and cut and paste the contents from the old directory structure, but I was hoping there was a "smarter" way to do this.
-
That works as you expect it. Just cd into the toplevel directory of your project (that containing the two subdirs) and call
@
qmake -project
@on the command line. This leaves a xxx.pro file in the dir, named after your directory. You can rename it it you want. qmake scans the dir recursively and puts all the header, implementation an UI files into the project file.
Then just open this .pro file in Creator and adjust all the settings.
-
OK, so...I hate to look like a thorough moron here, but...no use leaving things half-done.
I'm really inexperienced at command line stuff. I tried adding the path to the qmake program to my $PATH variable by adding this to my .bash_profile file:
@PATH="/Volumes/320 GB HD/Developer/Tools/Qt":$PATH
export PATH
@
But it still says qmake's not found. I realize this isn't a Qt question, but can someone tell me what I'm doing wrong here?Thanks...
-
[quote author="mzimmers" date="1299882964"]Thanks for the tip on mdfind.
The qmake file really doesn't seem to be there. I think I'd like to start over with Qt; what's the clean way to uninstall it?[/quote]
Sorry, I really don't know. I started with Qt at the Mac long before the binary packages and had to compile it manually, so I stick to this until now :-)
You might search the forum here, if I remember correctly, this was covered some time ago.
What's really strange is, that there is no qmake - it looks as if the setup did not install every piece correctly. Did you install the SDK or only the Qt libs (aka framework)?
And were you asked for an administrator password? Directory /usr/bin is root owned, even as user with admin privileges you must sudo to write to it.
-
Ahhhhhh...MUCH better!
I now have a qmake program (and who knows what else), and the new project created successfully over the existing source directories.
Qt also logically collects the files in the directory into Headers and Sources, so my existing directories created a second, undesired level of indirection. I moved all the files into one directory and did it over, and it seems fine now. (I might say that it's just a tad undesirable for Qt to do that, as it would be nice if I could preserve an existing directory structure, but...I'm not in the mood for complaining.)
Thanks for all the help, guys. It does seem better to do it from the command line.
BTW: the -project switch for qmake is undocumented, at least when you type "qmake" in the terminal window.