4

I want to report a solution to an error I got while installing OpenFOAM 3.0.1 in Mac OS X El Capitan Version 10.11.2 The error was:

"error: member reference type 'std::istream *' (aka 'basic_istream *') is a pointer; maybe you meant to use '->'? yyin.rdbuf(std::cin.rdbuf());"

This problem is related to flex version 2.6.0. which I installed using macports.

I could overcome the problem by using "flex 2.5.35 Apple(flex-31)" which is at /usr/bin/flex (instead of /opt/local/flex).

Just change "flex" to "/usr/bin/flex" in the file $(WM_DIR)/rules/General/flex++ of your openfoam source distribution.

5
  • I don't know anything about this version of flex but it seems yyin is a pointer. Try to use yyin->rdbuf(std::cin.rdbuf());. Commented Dec 23, 2015 at 14:57
  • On stackoverflow, answering its own question is encouraged, as long as you pretend you’re on Jeopardy! -- phrase it in the form of a question. Commented Dec 23, 2015 at 15:05
  • 1
    Really, it would be more effective to report an OpenFOAM bug directly; which might help get the problem fixed. It's possible that this question might help some potential openfoam user who is able to search StackOverflow for their problem, but there are probably many potential users who would miss it. Commented Dec 23, 2015 at 17:11
  • Thank you very much, this helped! (not for OpenFOAM btw. I had trouble with a completely unrelated package) Commented Dec 4, 2016 at 15:38
  • installing OpenFOAM-7 same issues, solved by using 2.5.xx flex. Commented Aug 6, 2019 at 2:00

2 Answers 2

3

I think this might be a bit of a late answer, but I believe the issue is an out of sync "FlexLexer.h". Flex 2.6.0 changed the storage definition of yyin storage for C++ scanners for both the header and the generated source. However I suppose the mac port package is including an out-of-date FlexLexer.h, even though flex itself has been updated. This leads to the mismatch you are seeing as compilation errors.

Instead of downgrading your flex install, you might be able to just use a newer "FlexLexer.h" (for example the one from here: https://github.com/westes/flex/blob/master/src/FlexLexer.h)

Sign up to request clarification or add additional context in comments.

Comments

1

I just compiled OpenFOAM v6 from the source code and got the same error - so this issue is still relevant. The error arised in wmake surfmesh where the first error was something like this

flex -+ ..........  
.../OpenFOAM/OpenFOAM- 6/platforms/linux64GccDPInt32Opt/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L.C: In member function ‘int STLASCIILexer::lex()’:  
.../OpenFOAM/OpenFOAM-6/platforms/linux64GccDPInt32Opt/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L.C:5494:9: error: request for member ‘rdbuf’ in ‘((STLASCIILexer*)this)->STLASCIILexer::<anonymous>.yyFlexLexer::yyin’, which is of pointer type ‘std::istream* {aka std::basic_istream<char>*}’ (maybe you meant to use ‘->’ ?)
yyin.rdbuf(std::cin.rdbuf());

The solution provided by changing flex to /usr/bin/flex in $HOME/OpenFOAM/OpenFOAM-6/wmake/rules/General/flex++ worked out for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.