CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Compile my own c++ class (https://www.cfd-online.com/Forums/openfoam-programming-development/242169-compile-my-own-c-class.html)

Erikaaa April 8, 2022 03:39

Compile my own c++ class
 
Hi, Foamers!

I'm using openFoam v2106 to program my own solver. For convenience, I write a new C++ class.

My problem: when I complie the new class alone, it works and corresponding file libIBSystem.so has been created successfully. However, when I complie the whole solver project(the solver's main file .C and new class .C), it doesn't work.

I think my options file is not appropriate, but I don't know how to modify it. If someone can help me, I will be very grateful. Thank you!

This is my options files (my new class name: IBSystem):
Code:

EXE_INC = \
    -IIBSystem/lnInclude                            //Added: doesn't work
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude

EXE_LIBS = \
    -L$(FOAM_USER_LIBBIN) -lIBSystem \    //Added: works
    -lfiniteVolume \
    -lmeshTools

Problem:
Code:

Make/linux64GccDPInt32Opt/options:60: *** missing separator.  Stop.
Make/linux64GccDPInt32Opt/options:60: *** missing separator.  Stop.
wmake error: file 'Make/linux64GccDPInt32Opt/sourceFiles' could not be created in /home/dyfluid/Desktop/immersedBoundary

I modify this options file by referring to this link:
http://www.tfd.chalmers.se/~hani/kur...InOpenFOAM.pdf

Shibi April 8, 2022 04:17

Aren't you missing a backslash?

Quote:

Originally Posted by Erikaaa (Post 825815)
Code:

EXE_INC = \
    -IIBSystem/lnInclude  \    <-- missing back slash                   
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude

EXE_LIBS = \
    -L$(FOAM_USER_LIBBIN) -lIBSystem \    //Added: works
    -lfiniteVolume \
    -lmeshTools

[CODE]


Erikaaa April 8, 2022 04:37

Quote:

Originally Posted by Shibi (Post 825819)
Aren't you missing a backslash?

It works perfectly! Thank you!

By the way. What is the role of this backslash? when I should use this symbol?
When I learned others' cases, this symbol sometimes appears and sometimes it doesn't.

olesen April 8, 2022 11:51

Quote:

Originally Posted by Erikaaa (Post 825823)
It works perfectly! Thank you!

By the way. What is the role of this backslash? when I should use this symbol?
When I learned others' cases, this symbol sometimes appears and sometimes it doesn't.


Backslash with a newline means a line continuation when using pre-processing macros. Be certain that you do not have something like "backslash spaces newline" - this will not work!


All times are GMT -4. The time now is 06:53.