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

Linking OF into QTcreator (GUI creation)

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By ngj

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 6, 2015, 06:08
Default Linking OF into QTcreator (GUI creation)
  #1
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Dear all,

I am currently having a small side project, where I would like to make a small GUI for OpenFoam. I have started in QTCreator, and it is surprisingly easy to get somewhere. Though, I have run into a problem.

I would like to use the IO functionality present in OF to read OF-dictionaries, so I do not have to write this entire IO-class again. As a starting point I simply included IOstream.H in the header-file of the QT-project and I got the following error:

Code:
 p, li { white-space: pre-wrap; }  In file included from ../debug/mainwindow.h:5:0,
                  from ../debug/main.cpp:2:
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H:104:13: error: 'scalar' in namespace 'Foam' does not name a type
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H:115:37: error: 'scalar' in namespace 'Foam' does not name a type
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H:115:50: error: ISO C++ forbids declaration of 'num' with no type [-fpermissive]
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H:132:41: error: 'scalar' in namespace 'Foam' does not name a type
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H:132:54: error: ISO C++ forbids declaration of 'num' with no type [-fpermissive]
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H: In constructor 'Foam::IOstream::versionNumber::versionNumber(int)':
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H:117:21: error: class 'Foam::IOstream::versionNumber' does not have any field named 'versionNumber_'
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H: In constructor 'Foam::IOstream::versionNumber::versionNumber(Foam::Istream&)':
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H:124:21: error: class 'Foam::IOstream::versionNumber' does not have any field named 'versionNumber_'
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H:124:49: error: 'readScalar' was not declared in this scope
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H:125:42: error: 'versionNumber_' was not declared in this scope
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H: In member function 'int Foam::IOstream::versionNumber::numberToIndex(int) const':
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H:134:41: error: 'SMALL' was not declared in this scope
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H: In member function 'int Foam::IOstream::versionNumber::majorVersion() const':
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H:140:32: error: 'versionNumber_' was not declared in this scope
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H: In member function 'int Foam::IOstream::versionNumber::minorVersion() const':
 /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude/IOstream.H:146:38: error: 'versionNumber_' was not declared in this scope
 make: *** [main.o] Error 1
I have linked (right now with absolute path) as follows:

Code:
INCLUDEPATH += /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude
DEPENDPATH += /home/ngja/foam/foam-extend-3.1/src/foam/lnInclude
unix:!macx:!symbian: LIBS += -L/home/ngja/foam/foam-extend-3.1/lib/linux64GccDPOpt -lfoam
The interesting thing is that I tried to include "PtrList.H" instead, and the compiler happily goes through the source until it reaches these exact declarations of 'scalar' in IOstream.H. Furthermore, trying to include "vector.H" as a third option, it also complains about a missing definition of scalar.

I have checked and scalar.H is located in the same include directory as vector.H and IOstream.H.

Has anyone tried anything similar? What is it with the declaration of scalar that makes this difficult?

I have added a tiny debug-project for QTCreator.

Thank you for any advice or shared experiences,

Kind regards,

Niels
Attached Files
File Type: gz debug.tar.gz (3.0 KB, 5 views)
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   July 23, 2015, 15:51
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Dear all,

I am now back at this issue and I seem to have found the error (at least it now compiles, but I have not yet had time to implement what I want).

It is very simple. QtCreator creates a file with various settings (*.pro) and this line is needed:

Code:
DEFINES += WM_DP
because the definition of scalar is within the pre-processor statement:

Code:
#if defined(WM_SP)
    //<definition of single precision scalar>
#elif defined(WM_DP)
    //<definition of double precision scalar>
#endif
I hope that this can help someone else in the future.

Kind regards,

Niels
arman3939 likes this.
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   May 20, 2017, 09:05
Default
  #3
Senior Member
 
khedar
Join Date: Oct 2016
Posts: 111
Rep Power: 9
khedar is on a distinguished road
Hi ngj,
Nice project there . I just started on a similar project to read, write and explore dictionary files for a particular case (so basically a case manager). I have a few questions if you have some time to answer.

1. I just went through the hexBlocker source code and observed that you are not using any of the openfoam classes. Any specific reasons or you found Qt IO classes to be adequate for your application.

2. I tried including the header files in the my Qt application. File inclusion is working fine but Qt does not seem to resolve the system environment variables which are used in some of the OF header files (WM_* variables). So my build fails. I tried adding the variable manually to the build environment but still it does not resolve them. Do you face similar problem anytime?

Thanks and Best regards,
khedar
khedar is offline   Reply With Quote

Old   May 20, 2017, 12:22
Default
  #4
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Khedar,

I never got any further with my GUI project, so I cannot be of any help. Please note that I did not develop hexBlocker, so you might direct your first question somewhere else.

Kind regards

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   May 21, 2017, 14:18
Default
  #5
Senior Member
 
khedar
Join Date: Oct 2016
Posts: 111
Rep Power: 9
khedar is on a distinguished road
Hi Niels,
Sorry I mixed up. Anyways I was able to do the linking. I will try to make the GUI now.

Thanks,

Khedar
khedar is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with surface creation in ICEM from multiple curves dialolema ANSYS Meshing & Geometry 2 October 27, 2014 13:14
corrupted double-linked list error when linking certain libraries AlmostSurelyRob OpenFOAM Programming & Development 0 November 26, 2013 06:47
Linking Problem in TECIO nw_ds Tecplot 1 November 6, 2013 11:41
Dfconsol.lib or Ifconsol.lib for linking earexe ? Noel Phoenics 5 October 15, 2008 09:50
OpenFOAM with Cygwin kitchener OpenFOAM Installation 6 April 24, 2006 23:09


All times are GMT -4. The time now is 02:49.