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

Compile my own c++ class

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

Like Tree1Likes
  • 1 Post By Shibi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 8, 2022, 03:39
Default Compile my own c++ class
  #1
New Member
 
Zhang Yan
Join Date: Nov 2021
Posts: 15
Rep Power: 4
Erikaaa is on a distinguished road
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
Erikaaa is offline   Reply With Quote

Old   April 8, 2022, 04:17
Default
  #2
Member
 
Join Date: Feb 2020
Posts: 90
Rep Power: 6
Shibi is on a distinguished road
Aren't you missing a backslash?

Quote:
Originally Posted by Erikaaa View Post
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 likes this.
Shibi is offline   Reply With Quote

Old   April 8, 2022, 04:37
Default
  #3
New Member
 
Zhang Yan
Join Date: Nov 2021
Posts: 15
Rep Power: 4
Erikaaa is on a distinguished road
Quote:
Originally Posted by Shibi View Post
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.
Erikaaa is offline   Reply With Quote

Old   April 8, 2022, 11:51
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,684
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Erikaaa View Post
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!
olesen 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
[waves2Foam] Compile waves2FoamMooring on OF1912 romainping OpenFOAM Community Contributions 5 October 11, 2021 16:52
GeometricField -> mesh() Function Tobi OpenFOAM Programming & Development 10 November 19, 2020 11:33
Adding new class, how to compile it? aman_baig SU2 3 January 23, 2020 19:03
PV3FoamReader compile error.... PEM_GUY OpenFOAM Installation 6 April 5, 2010 17:22
Expanding a class fabianpk OpenFOAM 0 October 3, 2005 04:26


All times are GMT -4. The time now is 07:35.