1
votes

I would like to use the same header and source file in multiple, closely related projects. Qt creator allows to have multiple projects open in the Projects bar, and it allows to "Add existing files". I can add source files from an other project to my current project, it appears nicely in the tree structure, but I can't #include them. The compiler just can't find them, even if they are included in the project. I even looked into the .pro file, and they appear there, with a relative path.

What is the best practice? If possible, I would like to avoid using any paths, even relative ones in the #include s in my source files, so the actual location of all the files would only be in the project file and nowhere else.

1

1 Answers

1
votes

You can add include-file search paths in the .pro file like this:

INCLUDEPATH += ../MyIncludeFilePath0 F:/MyProj/MyIncludeFilePath1 etc.