Error linking Matlab generated C-code: start.S:114: undefined reference to `main' collect2
1 view (last 30 days)
Show older comments
Mark Scheffer
on 29 Jun 2016
Answered: Mark Scheffer
on 30 Jun 2016
When using Matlab Code Generator to generate an executable, I get the following error (see below) at the linking stage. Is this due to having a too new glibc version 5.2.x (because I use Ubuntu 15.10 rather than 14.x) and is there any solution other than to reinstall my complete system with Ubuntu 14.10 and glibc 4.7.x ??
Please advice where this error comes from and if it can somehow be resolved.
Thanks, Mark.
---------- gcc error:
gcc -Wl,-rpath,"/usr/local/MATLAB/R2016a/bin/glnxa64",-L"/usr/local/MATLAB/R2016a/bin/glnxa64" -L/usr/local/MATLAB/R2016a/sys/os/glnxa64 -fopenmp -liomp5 -o /home/mscheffer/Desktop/kstar/rtda/matlab/mse_rtda mse_rtda_rtwutil.o mse_rtda_data.o mse_rtda_initialize.o mse_rtda_terminate.o mse_rtda.o cos.o sin.o besselj.o cbesj.o abs.o sqrt.o cbinu.o gammaln.o cuchk.o cmlri.o casyi.o cuoik.o cunhj.o cunik.o extract_cosine.o interp1.o mean.o bsxfun.o correctphase.o sum.o norm.o std.o permute.o any.o getstokes.o mse_rtda_emxutil.o rt_nonfinite.o rtGetNaN.o rtGetInf.o -lm
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
/build/glibc-qbmteM/glibc-2.21/csu/../sysdeps/x86_64/start.S:114: undefined reference to `main'
collect2: error: ld returned 1 exit status
0 Comments
Accepted Answer
Ryan Livingston
on 29 Jun 2016
To build an executable you need to specify a main function via MATLAB Coder. You can also use the example main function generated by MATLAB Coder in the examples directory as a starting point for your own main.
0 Comments
More Answers (1)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!