
Originally Posted by
Radek
You can add existing files to the project by right clicking the project folder in the project tree of the Creator. The popup menu contains item "Add Existing Files". Add existing files

A few recommendations:
(1) Keep all project files in some manageable structure. Do not allow project files scattered over your disk. Copy all existing files to subdirectories of your project directory.
(2) Patch the profile file yourself as little as possible and let the Creator to manage the profile file. Specify TEMPLATE, QT, TARGET, INCLUDEPATH, DEPENDPATH, LIBS. The rest can be done from the Creator: Add files, add existing files, remove files, rename files, resources, forms (a new .ui file -> add existing files).
Thanks Radek I did try this option as well and the project compiled ok. However my intention is to konw how linking goes "done manualy" and learn from a real example.
I did a few experiments with directive in "pro" file and here are my findings:
1) in order to include the source code of my c++ app, the "precalc" function in mat.cpp file, to be precise, I need to add:
INCLUDEPATH += "C:\Users\myuser\Documents\elab_c_proj"
INCLUDEPATH += "C:\Users\myuser\Documents\elab_c_proj"
To copy to clipboard, switch view to plain text mode
by this I get access to my "precalc" function in design time.
SOURCES += "C:\Users\myuser\Documents\elab_c_proj\mat.cpp"
SOURCES += "C:\Users\myuser\Documents\elab_c_proj\mat.cpp"
To copy to clipboard, switch view to plain text mode
by this qmake compiles "mat.cpp" to "mat.o" and adds it to the my qt project release folder.
This way the compilation goes ok, however I still need to solve a few puzzles. So I did compile mat.ccp in my "elab_c_proj" folder manualy with mingw which produced "mat.o" file, afterwards I removed the "SOURCES" directive in my qt project and added
LIBS += "C:\Users\myuser\Documents\elab_c_proj\mat.o"
LIBS += "C:\Users\myuser\Documents\elab_c_proj\mat.o"
To copy to clipboard, switch view to plain text mode
I cleaned the qt project and compiled it just ok. However the "mat.o" file is not copied in my qt project release directory. I guess it is builded in my final exe of qt projcect file, am I right? So I guess I did successfuly staticaly link my "precalc" function. Now the question is how do I link to it dynamically? Thanks again for your help.
Bookmarks