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

Passing compiler options to wmake?

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

Like Tree1Likes
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 13, 2015, 08:16
Default Passing compiler options to wmake?
  #1
Senior Member
 
Bernhard Linseisen
Join Date: May 2010
Location: Heilbronn
Posts: 183
Blog Entries: 1
Rep Power: 15
Linse is on a distinguished road
Dear all,

while I am sure that most warnings during compilation can be mitigated by perfect code, sometimes it might be advantageous during debugging to add some additional compiler options.
For example during compiling of some code, wmake suggests to use "-Wreorder" as a compiler option. Alas, just running "wmake -Wreorder" does fail, telling me "-Wreorder" was an unknown option.
Thus my question is:

How can I pass on g++-options to the compilation with wmake?

Thanks for your answers already in advance!

Cheers,
Bernhard
Linse is offline   Reply With Quote

Old   April 13, 2015, 09:06
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Dear Bernhard,

Quote:
For example during compiling of some code, wmake suggests to use "-Wreorder" as a compiler option. Alas, just running "wmake -Wreorder" does fail, telling me "-Wreorder" was an unknown option.
In fact it is not wmake who suggests, it is g++. So you can use Make/options file for compiler options. Add compile time options to EXE_INC, link time options to EXE_LIBS.
alexeym is offline   Reply With Quote

Old   April 13, 2015, 18:36
Default
  #3
Senior Member
 
Bernhard Linseisen
Join Date: May 2010
Location: Heilbronn
Posts: 183
Blog Entries: 1
Rep Power: 15
Linse is on a distinguished road
Thanks a lot for your message. Unfortunately it did not work. Seems, the options in brackets behind the compiler-warnings either were wrong or did come from something different...

If for example there is
OpenFOAM/OpenFOAM-2.3.x_latest/src/finiteVolume/lnInclude/readTimeControls.H:38:8: warning: unused variable ‘maxDeltaT’ [-Wunused-variable]
I would assume "-Wunused-variable" says what compiler option would switch of this warning.

But it definitely took the included options into account, as it checked them for right spelling (--Wreorder brought up an error, as it did not accept the double - in front).
Further ideas?

Cheers,
Bernhard
Linse is offline   Reply With Quote

Old   April 14, 2015, 02:14
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

To avoid assumptions about compiler behavior one can look into manual:

Quote:
You can request many specific warnings with options beginning with ‘-W’, for example -Wimplicit to request warnings on implicit declarations. Each of these specific warning options also has a negative form beginning ‘-Wno-’ to turn off warnings; for example, -Wno-implicit.
(https://gcc.gnu.org/onlinedocs/gcc-4...arning-Options)

And example, if I have these options:

Code:
EXE_INC = \
    ...
    -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
    -DFOAM_VERSION=${FOAM_VERSION} \
    -Wreorder \
    -Wno-undefined-bool-conversion
during compilation I will get

Code:
In file included from myFoam.C:75:
$HOME/OpenFOAM/OpenFOAM-2.3.1/src/finiteVolume/lnInclude/readTimeControls.H:38:8: warning: unused variable
      'maxDeltaT' [-Wunused-variable]
scalar maxDeltaT =
       ^
1 warning generated.
so if I add to options:

Code:
EXE_INC = \
    ...
    -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
    -DFOAM_VERSION=${FOAM_VERSION} \
    -Wreorder \
    -Wno-unused-variable \
    -Wno-undefined-bool-conversion
compilation finishes without warnings.
calf.Z likes this.
alexeym is offline   Reply With Quote

Old   April 14, 2015, 04:01
Default
  #5
Senior Member
 
Bernhard Linseisen
Join Date: May 2010
Location: Heilbronn
Posts: 183
Blog Entries: 1
Rep Power: 15
Linse is on a distinguished road
Gosh, I always thought I was capable of thinking and remembering the famous four letter-paradigm of programming - rtfm.
But it seems sometime a reminder - moreover such a helpful one - is quite in place! ;-)

Thanks a lot, by now I know my warnings and compiler messages were of a low-urgency magnitude!
Linse is offline   Reply With Quote

Reply

Tags
options, wmake

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


All times are GMT -4. The time now is 00:59.