Re: [eigen] Port Eigen-project from Visual-C++ to ObjC

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Dear Antonio,

thank you very much for these tips! I will try them …

Sincerely,

Albert


Am 24.07.2023 um 17:41 schrieb Antonio Sanchez <cantonios@xxxxxxxxxx>:

From the error, it sounds like an issue with your includes - I would double-check that before troubleshooting anything else.  Theoretically, if you are using Objective-C++, you should be able to include C++ headers just fine.

Though from a brief search, I did find references that "sometimes this can lead to issues", without any specific cause mentioned.  From what I've found, it suggests exporting a C interface and using that in your Objective-C program.   To do that, you would need to isolate all your use of Eigen to a C++ translation unit, write your own C wrapper around it, using something like

#ifdef __cplusplus
extern "C" {
#endif
// Your wrapper implementation here.
#ifdef __cplusplus
}
#endif
You would then need to build your wrapper with a C++ compiler.  Once you have that, your Objective-C program should be able to link to this without issue.
~Antonio

On Mon, Jul 24, 2023 at 7:38 AM Lang, Albert-Georg <Albert.Lang@xxxxxx> wrote:
Hello all,

I want to port a project which uses Eigen from Visual C++ to Objective-C(++) for Macintosh computers. The problem is that I always get multiple error messages (e.g., "Explicit specialization of undeclared template struct 'traits'" in Block.h, see picture). I get these same error messages regardless of which (Eigen-) project I am compiling as soon as I mix Objective-C with C++ (which comes with Eigen). What does work is compiling a pure C++ project.

I have read on stackoverflow that this might have to do with the "language" Objective-C++, this means that this specific C++ code cannot be easily compiled with a C compiler. Unfortunately, the tip described on this page does not work.

Any help would be welcome!

Sincerely, Albert

<Bildschirmfoto 2023-07-24 um 16.23.51.png>




Attachment: smime.p7s
Description: S/MIME cryptographic signature



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/