|
[Sponsors] |
June 19, 2018, 11:35 |
QtCreater and header files in OpenFOAM
|
#1 |
New Member
Jesper R. K. Qwist
Join Date: Dec 2017
Posts: 22
Rep Power: 9 |
Hi Foamers,
I have recently been looking at 2 IDE's (Integrated Developer Environment) for OpenFOAM. I have tested Eclipse and QtCreater. In QtCreater the setup is very fast and the auto-completion works for the main .C file. In my case I created a project based on a copy of the solver interIsoFoam. Besides the *.C file there are several *.H files. This is very nice, since it gives more clarity to the code. However, here comes the but... The auto-completion does not work in the *.H files, because its required dependencies to other header files are not defined in the current header file. It is no problem for the compiler, since the headers are defined in the .C file. I don't understand: 1) Why all header files are not guarded against multiple includes. 2) Why the needed dependencies are not included in each header file. Can anyone enlighten me on this? |
|
June 25, 2018, 06:45 |
|
#2 |
Member
Andrew Coughtrie
Join Date: May 2011
Posts: 51
Rep Power: 15 |
1) In the solvers the .H files aren't actually header files, they are mainly used to keep the code more readable as far as I know.
A workaround for qtcreator autocomplete in header files with solvers is to include the .C file at the top, just remember to comment it out when compiling since obviously it won't work otherwise. Andrew |
|
June 25, 2018, 08:54 |
|
#3 |
New Member
Jesper R. K. Qwist
Join Date: Dec 2017
Posts: 22
Rep Power: 9 |
Thank you for your answer.
So if I understand you correctly, I should include the main .C file in the header files, where I want auto-completion to work? Jesper |
|
June 25, 2018, 08:59 |
|
#4 |
Member
Andrew Coughtrie
Join Date: May 2011
Posts: 51
Rep Power: 15 |
Yes so it would be #include "interIsoFoam.C" for your template solver. It is the only workaround I've managed for qtcreator.
Andrew |
|
June 25, 2018, 09:03 |
|
#5 |
New Member
Jesper R. K. Qwist
Join Date: Dec 2017
Posts: 22
Rep Power: 9 |
Okay, I got it working now.
Thank you for the tip, I think it is very useful. The alternative would be to copy the code pieces saved in header files back in to the .C file, and then it will be harder to read the code. Jesper |
|
Tags |
eclipse, header, header files, ide, qtcreater |
|
|