Error: could not fully parse value "2" as an int

I am new to precice and running into an odd issue. I’m just trying to replicate some of the functionality in the solid-cpp quick tutorial, which runs fine for me. But when I create my own code, precice throws this cryptic error message:

error: could not fully parse value “2” as an int.

Then the code crashes.
The error is occurring when it is trying to construct the SolverInterface object:

precice::SolverInterface precice("Solid", "precice-config.xml", 0, 1);

The config file is in the same location as the executable.
I hope I’m not missing anything obvious, but I don’t know what this error message means and how to solve the problem. Any insight would be appreciated! TIA!

Sounds to me like a simple formatting problem in your precice-config.xml.
Did you modify the file? If yes, could you upload your current file?

Which preCICE version are you using?

I did not modify the precice-config.xml file. It is the exact same file that is used in the solid-cpp quick tutorial, which runs fine for me. I use precice version 2.2.0.

I don’t know if this helps, but the code I was working on tries to call precice from within a shared object (which is used as a plugin for another code). When I run the exact same code from a stand-alone executable, precice initializes fine, so it looks like it may something to do with calling precice from within a shared object, but not sure. In any case, I do have a work-around so this is not an urgent issue. Thanks!

Hi @belgiansteve

Is there a trace back available to the error you have mentioned above? If there is more information from where the error comes it could help in debugging.

Do you see this error when running the code which uses the shared object which has preCICE calls in it?

@belgiansteve This looks like an really weird locale issue.

preCICE tries to internally enforce use the en_US.UTF-8 locale for parsing.
This prevents problems with varying characters for the decimal separator (2.0 or 2,0?) etc.

This error message means that 2 cannot be parsed as an int at all, which is very very strange.

Could you try to find out which locale the other code sets before it uses the shared object to construct preCICE?
If you have this information, please open an issue to keep track of this issue.


Sorry for the belated reply. We got around this issue so it wasn’t as pressing anymore.

Although I don’t have a final explanation, I suspect that the problem was actually a linking issue, where the linker somehow had linked the wrong functions for parsing the xml file. We were linking precice to another library that had its own xml parser and I think that some of the functions had identical names. We ended up reorganizing our code and how the libraries all tie together, and the problem just went away.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.