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

understanding wmake

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 11, 2015, 15:31
Default understanding wmake
  #1
New Member
 
Join Date: May 2013
Posts: 6
Rep Power: 13
thanasis is on a distinguished road
Dear all,

I am having difficulties in understanding how wmake works and how I can correctly compile an application to include subdirectories in the application folder.

I was experimenting using a rather simple example, which I named test_wmake utility. For this I employed the following file structure:

HTML Code:
Folder test_utility
    test_wmake.C
    -Folder Make
        -files
        -options
    -Folder Classes
        classA.H
        classA.C
        -Folder classB
            classB.H
            classB.C
The files were as follows:

test_wmake.C:
Code:
#include "fvCFD.H"
#include "Classes/classA.H"

int main(int argc, char *argv[])
{
    
    A A_(2.0);
    
    Info << A_.f(2.0) << endl;
    
    return 0;
}
Make/files:
Code:
test_wmake.C
Classes/classA.C
Classes/classB/classB.C

EXE = $(FOAM_USER_APPBIN)/test_wmake
Make/options:
Code:
EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude \

EXE_LIBS = \
    -lfiniteVolume \
    -lgenericPatchFields
Classes/classA.H:
Code:
#ifndef CLASSA_H
#define CLASSA_H

#include "classB/classB.H"

namespace Foam
{
class A
{
    public:
        A(const double inX);
        ~A();
        
        double f(const double x) const;
        
    private:
        mutable B B_;
};
}
#endif // CLASSA_H
Classes/classA.C:
Code:
#include "classA.H"

namespace Foam
{
    A::A(const double inX) : B_(inX) {}
    A::~A() {}
    
    double A::f(const double x) const
    {
        return B_.f(x);
    }
    
}
Classes/classB/classB.H
Code:
#ifndef CLASSB_H
#define CLASSB_H

namespace Foam
{
class B
{
    public:
        B(const double inY);
        ~B();
        
        double f(const double x) const;
        
    private:
        double y_;
};

}

#endif // CLASSB_H
Classes/classB/classB.C:
Code:
#include "classB.H"

namespace Foam
{
    B::B(const double inY) : y_(inY) {}
    B::~B() {}
    
    double B::f(const double x) const
    {
        return x*y_;
    }
    
}
when running wmake &> log, I get the following:
Code:
Making dependency list for source file test_wmake.C
could not open file classB/classB.H for source file test_wmake.C due to No such file or directory
Making dependency list for source file Classes/classA.C
Making dependency list for source file Classes/classB/classB.C
SOURCE=test_wmake.C ;  g++ -m64 -std=c++0x -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/thanasis/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude  -IlnInclude -I. -I/home/thanasis/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/home/thanasis/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64Gcc++0xDPOpt/test_wmake.o
SOURCE=Classes/classA.C ;  g++ -m64 -std=c++0x -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/thanasis/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude  -IlnInclude -I. -I/home/thanasis/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/home/thanasis/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64Gcc++0xDPOpt/classA.o
SOURCE=Classes/classB/classB.C ;  g++ -m64 -std=c++0x -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/thanasis/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude  -IlnInclude -I. -I/home/thanasis/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/home/thanasis/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64Gcc++0xDPOpt/classB.o
g++ -m64 -std=c++0x -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/thanasis/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude  -IlnInclude -I. -I/home/thanasis/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/home/thanasis/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/POSIX/lnInclude   -fPIC -Xlinker --add-needed Make/linux64Gcc++0xDPOpt/test_wmake.o Make/linux64Gcc++0xDPOpt/classA.o Make/linux64Gcc++0xDPOpt/classB.o -L/home/thanasis/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64Gcc++0xDPOpt/lib \
         -lfiniteVolume -lgenericPatchFields -lOpenFOAM -ldl   -lm -o /home/thanasis/OpenFOAM/thanasis-2.3.x/platforms/linux64Gcc++0xDPOpt/bin/test_wmake
The application compiles correctly and when running test_wmake I get the correct answer. I do not understand though the very first error message "could not open file classB/classB.H for source file test_wmake.C due to No such file or directory" and how I can avoid this.

I am using openFoam 2.3.x which I compiled in ubuntru 14.04 using the Gcc++0x 4.8.2 compiler.

Any thoughts are mostly welcome!
thanasis is offline   Reply With Quote

Reply

Tags
subdirectories, wmake


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
OpenFOAM 1.7.1 installation problem on OpenSUSE 11.3 flakid OpenFOAM Installation 16 December 28, 2010 09:48
Problems Installing OF 1.6 32 bit bucksfan OpenFOAM Installation 19 August 4, 2009 02:36
OpenFOAM15 installables are incomplete problem with paraFoam tryingof OpenFOAM Bugs 17 December 7, 2008 05:41
Problem of compilation OF 14Allwmake command not found erik_d OpenFOAM Bugs 13 September 13, 2008 22:45
[OpenFOAM] ParaFoam error message joey ParaView 1 October 2, 2006 14:28


All times are GMT -4. The time now is 11:29.