CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

QtCreater and header files in OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 19, 2018, 11:35
Post QtCreater and header files in OpenFOAM
  #1
New Member
 
Jesper R. K. Qwist
Join Date: Dec 2017
Posts: 22
Rep Power: 9
Jesper_Roland is on a distinguished road
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?
Jesper_Roland is offline   Reply With Quote

Old   June 25, 2018, 06:45
Default
  #2
Member
 
Andrew Coughtrie
Join Date: May 2011
Posts: 51
Rep Power: 15
Andrew.Coughtrie is on a distinguished road
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
Andrew.Coughtrie is offline   Reply With Quote

Old   June 25, 2018, 08:54
Default
  #3
New Member
 
Jesper R. K. Qwist
Join Date: Dec 2017
Posts: 22
Rep Power: 9
Jesper_Roland is on a distinguished road
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
Jesper_Roland is offline   Reply With Quote

Old   June 25, 2018, 08:59
Default
  #4
Member
 
Andrew Coughtrie
Join Date: May 2011
Posts: 51
Rep Power: 15
Andrew.Coughtrie is on a distinguished road
Yes so it would be #include "interIsoFoam.C" for your template solver. It is the only workaround I've managed for qtcreator.

Andrew
Andrew.Coughtrie is offline   Reply With Quote

Old   June 25, 2018, 09:03
Default
  #5
New Member
 
Jesper R. K. Qwist
Join Date: Dec 2017
Posts: 22
Rep Power: 9
Jesper_Roland is on a distinguished road
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
Jesper_Roland is offline   Reply With Quote

Reply

Tags
eclipse, header, header files, ide, qtcreater


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 03:39.