|
[Sponsors] |
March 24, 2020, 06:28 |
Compiling a new thermophysical model
|
#1 |
Member
Join Date: Oct 2018
Location: France
Posts: 34
Rep Power: 7 |
Dear Foamers,
I'm making my own thermophysical model. For that reason I wrote some functions I want to you use to calculate the different properties (in thermoI.H, and the respective rho*I.H, transport*I.H, thermo*I.H files). I include the header-file declaring all my functions in "thermoI.H", otherwise the compilation fails, since my functions are not defined. The compilation of libspecie works w/o problems, but when I try to compile libfluidThermophysicalModels (in the "basic" folder), I get compiler errors telling me, that my functions are multiple defined, e.g. a small fraction of the error message: Code:
Make/linux64GccDPInt32Opt/rhoThermo/rhoThermos.o: In function `PN_sSCByPT(double, double)': rhoThermos.C:(.text+0x6bce0): multiple definition of `PN_sSCByPT(double, double)' Make/linux64GccDPInt32Opt/psiThermo/psiThermos.o:psiThermos.C:(.text+0x6bce0): first defined here These lines occur for all of my functions twice: - for psiThermos.o & rhoThermos.o - for psiThermos.o & liquidThermo.o It seems like the compiler declares the functions several times, since their definitions are called by "thermoI.H". I now tried several options to circumvent that issue, but without success. Does anybody has an idea how to solve that issue? Sincerely, stockzahn |
|
March 24, 2020, 09:24 |
|
#2 |
Senior Member
Gerry Kan
Join Date: May 2016
Posts: 348
Rep Power: 10 |
Dear Stockzahn:
It sounds like you might need to implement include guards to your header file, so that all the objects / functions only get declared once during compile. You should surround the contents of your header file with the following lines: Code:
#ifndef __YOUR_HEADER_NAME__ #define __YOUR_HEADER_NAME__ // contents of your original header file goes here #endif Last edited by Gerry Kan; April 16, 2020 at 07:54. |
|
March 24, 2020, 11:10 |
|
#3 |
Member
Join Date: Oct 2018
Location: France
Posts: 34
Rep Power: 7 |
Dear Gerry,
thanks for the fast response, unfortunately that didn't work. stockzahn EDIT: I solved it: obviously a very beginner's mistake: I tested the functions in a different program, for which in included all C-files in the header files. This was the problem, I just copied all files into the inlude-folder and deleted the #include-commands in the header-files. But thanks for the hint with the include guards! That will be advantegeous in the future. Last edited by stockzahn; March 24, 2020 at 12:48. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[IHFOAM] The IHFOAM Thread | Phicau | OpenFOAM Community Contributions | 392 | September 8, 2023 18:10 |
viewFactor radiation model stuck | shach934 | OpenFOAM | 1 | May 25, 2021 11:01 |
[swak4Foam] swakExpression not writing to log | alexfells | OpenFOAM Community Contributions | 3 | March 16, 2020 18:19 |
Thermophysical transport model to include shear rate | Janez Turk | OpenFOAM Programming & Development | 3 | March 24, 2018 11:30 |
Water subcooled boiling | Attesz | CFX | 7 | January 5, 2013 03:32 |