Imported subdirs project using git and Qt Creator can't find libraries
This is probably a frequently asked question, but I did a little searching and couldn't find anything on the surface. I started a subdirs project on my laptop in the front room. I put my libraries in folders separate from the app and added them to the app by right-clicking on the project tree and selecting add library. The program compiles and runs just fine.
I set up a project on sourceforge ("VIMAT":https://sourceforge.net/projects/vimat/) and sent everything over using Git. When I went to my office to clone on my desktop, Qt Creator recommended not to use the same project settings. I got all of the files, but now the program won't run. I tried using the same process that I did on my laptop to add the libraries to the subprojects. It keeps giving me "/usr/bin/ld: cannot find -lvimatDB" and "collect2: ld returned 1 exit status." I'm sure there is more configuring that needs to be done. I know a little bit about writing code and I know much less about the whole make/build process. I don't know where to begin to get this working on my desktop. Any ideas?
The vimat.pro file should be part of the source but the Qt Creator related settings file (vimat.pro.user) generally should not be because they will be different from machine to machine, platform to platform etc.
You should use
CONFIG += ordered
in your vimat.pro file to ensure that the vimatLibrary is built before the other components that require it to exist in order to build. Without "ordered" the four sub directories may be traversed in any order.
See "qmake Project files" in the qmake manual.
Thank you so much! I added that line to my project file and reordered my subdirs the way they're supposed to be right below that line and now it's running on both computers. I'm glad this isn't going to be an ordeal any longer.
Your reply begs the question: How do you tell Qt Creator that you want to store the settings file outside the project? Obviously it would be silly to continue sending that back and forth to the repository when it doesn't do any other machines any good. I searched online and saw people wanting to locate it so they could back it up, but not relocate it. I looked in the options on Qt Creator and didn't see anything in there.
Thanks again, Chris
There isn't an option to get Qt Creator to store the .pro.user file in a different location. Instead I suggest you remove it from git and set up a git ignore rule.
Remove the existing file from git without removing it from the working directory:
git rm --cached *.pro.user
git commit -m "Remove .pro.user file from git"
The add the follow to the .gitignore file (see git help ignore)
And thanks to you. Worked like a charm. Some day I hope to have my own sense of InTuition when it comes to problem-solving like this.