compilation failed: too many initializers

Hi, I have generated a mexFunction using Matlab Coder; however the standalone mexFunction can't run on another version of Matlab due to some dependency issues (missing DLLs). Together with the mexFunction, there were also many other .c and .h files generated with Coder. I am now trying to recompile the generated .c files into mexFunction with the Matlab in which the final result must run perfectly. Unfortunately, I get the following error:
error C2078: too many initializers
What should I do to amend this?
Thanks in advance!

7 件のコメント

Walter Roberson
Walter Roberson 2012 年 5 月 4 日
Could you show us an example of a line that it is complaining about too many initializers?
Kaustubha Govind
Kaustubha Govind 2012 年 5 月 4 日
Try using the Makefile that is generated by MATLAB Coder instead.
Jane Jean
Jane Jean 2012 年 5 月 4 日
mex ('randn1_mex.c', 'randn1_date.c', '...', blaslib, lapacklib)
... is the other .c files generated by Coder.
There is also a makefile .mk generated by Coder. How can I make use of this .mk file to recompile the mexFunction using the .c and .h files that Coder has generated?
Thank you for your help. :)
Walter Roberson
Walter Roberson 2012 年 5 月 4 日
Actually I meant an example of the line of C code that is being complained about.
Jane Jean
Jane Jean 2012 年 5 月 4 日
the exact error message is as following:
randn1_mex.c(23) : error C2078: too many initializers
and in randn1_mex.c, line 23 is:
emlrtContext emlrtContextGlobal = { true, false, EMLRT_VERSION_INFO, NULL, "randn1", NULL, false, NULL, false, 1, false };
Kaustubha Govind
Kaustubha Govind 2012 年 5 月 4 日
Jane: You need to have a make utility installed. For example, if you have Visual Studio, you should be able to call nmake.exe from a VS command window. Just say "nmake -f foo.mk".
Kaustubha Govind
Kaustubha Govind 2012 年 5 月 4 日
Also, I would recommend looking into the Makefile to see what compiler commands are being used. You will need the corresponding compiler to be installed. For example "cl.exe" is the Visual Studio compiler.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

質問済み:

2012 年 5 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by