How to compile from a linux command line matreadstructarray.c using gcc?

1 view (last 30 days)
I'd like to compile from the command line one of the sample files, but I receive the following error when I do so. (I copied matreadstructarray.c' to my 'c' folder). Any help would be appreciated. Thanks.
<179 pebble2:~/c > *gcc -o a.out matreadstructarray.c -I "/soft/linux/matlab2017b/extern/include"*
/tmp/ccjtgFoj.o: In function `analyzestructarray':
matreadstructarray.c:(.text+0x21): undefined reference to `mxGetNumberOfElements'
matreadstructarray.c:(.text+0x46): undefined reference to `mxGetField'
matreadstructarray.c:(.text+0x5d): undefined reference to `mxGetClassID'
matreadstructarray.c:(.text+0x6e): undefined reference to `mxIsComplex'
matreadstructarray.c:(.text+0x7e): undefined reference to `mxGetPr'
/tmp/ccjtgFoj.o: In function `findstructure':
matreadstructarray.c:(.text+0xf5): undefined reference to `matOpen'
matreadstructarray.c:(.text+0x133): undefined reference to `matGetVariable'
matreadstructarray.c:(.text+0x16a): undefined reference to `mxGetClassID'
matreadstructarray.c:(.text+0x182): undefined reference to `mxGetFieldNumber'
matreadstructarray.c:(.text+0x1d6): undefined reference to `mxDestroyArray'
matreadstructarray.c:(.text+0x1e2): undefined reference to `matClose'
collect2: error: ld returned 1 exit status
<180 pebble2:~/c >

Answers (1)

Darshan Ramakant Bhat
Darshan Ramakant Bhat on 17 Jan 2018
I found the similar issue being discussed in the below MATLAB answer post:
I hope this will help you.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!