[Gmsh] Multiple-definition error with the gmsh.h_cwrap header for the C++ API

Juan Sanchez juan.e.sanchez at gmail.com
Tue Mar 12 19:27:41 CET 2019


Hello,

I am not a gmsh developer, but I suppose you could do something like this
in your code:
namespace {
#include "gmsh.h"
}

Then your object file will have a copy of each function in its own
anonymous namespace.

Regards,

Juan







On Tue, Mar 12, 2019 at 12:58 PM Julien Hess <julien.hess.ch at gmail.com>
wrote:

> Dear gmsh users,
>
> I would like to use the C++ API of the Linux SDK (compiled with GCC 4) in
> a program that I must compile with gcc-5.5.0.
>
> Specifying "-D_GLIBCXX_USE_CXX11_ABI=0" is not an option, as the program
> also uses several other libraries compiled with GCC 5 or higher.
>
> According to the `README.txt' in the SDK, another approach is to rename
> `gmsh.h_cwrap' as `gmsh.h' in order to redefine the C++ API in terms of the
> C API. If I do just that, the linker complains about several
> "multiple-definition" errors, which come from the fact that the functions
> in the `gmsh.h_cwrap' header are not *inline*d.
>
> My temporary solution was to manually inline the 4 utility functions and
> to "#define GMSH_API inline" for the rest of the API functions. This does
> the trick, but I am pretty sure the gmsh developers though of a cleaner
> solution. What is the proper way to use this `gmsh.h_cwrap' header?
>
> Thank you in advance for any advice, and many thanks and congratulations
> to the gmsh team for the amazing work!
>
> Cheers,
>
> Julien
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20190312/bb4dbc2b/attachment.html>


More information about the gmsh mailing list