Error when building the MATLAB API in VS

111 views
Skip to first unread message

Henry Boot

unread,
Feb 24, 2024, 4:53:08 PM2/24/24
to OpenVSP
I've gotten through the entire process shown in the 2020 workshop solving numerous problems along the way but i seem to be stuck at this point when building VSP_TOP.sln as it stops 75% of the way through on a error for the VSPmex project saying " 'mexFunction' : Redefinition ; different linkage"  the two photos below show the error and the location of the conflict. Should i just delete the first definition?
image2.png
image1.png

Henry Boot

unread,
Feb 25, 2024, 2:56:36 PM2/25/24
to OpenVSP


Here is the entire output from VS studio 2022 i am wondering if it could a problem with the CXX compiler? I'm not sure.

Rob McDonald

unread,
Feb 25, 2024, 4:00:00 PM2/25/24
to OpenVSP
Henry,

This option to build Matlab bindings is pretty rarely used.  You're out in the wild west here.

I thought there were some instructions on this, but I can't even find those now.

You have to start with a fork of the Swig project modified to work with Matlab.  I believe this project hasn't been touched since about 2016.

My gut says that MathWorks changed something from the time this stuff was put together and today.  The Swig bindings are expecting 'mexFunction' to be defined a certain way -- but today it is in fact defined differently.

The main Swig project is never going to include the Matlab modifications because they don't have free licenses to use on automated build servers to build, test, and package every new release of Swig.  Without continuous integration capabilities, maintaining and developing Swig (with a ton of abandoned bindings) is untenable.  A few years back, the Swig devs went through and culled a bunch of bindings that were no longer active.

So, I would look into the swig/Matlab community -- see if anyone has updates to Matlab 2021.  Or, I would see if I could go back to an old version of Matlab -- perhaps you can find access to Matlab 2016 and see if it can build there.

Otherwise, I'm not sure what to tell you.  I have never actually done this myself.  I don't know that anyone who has is still around.

Rob
Reply all
Reply to author
Forward
0 new messages