0

I get the below error when I run the make file which builds the c code generated by matlab. I believe I have missed to include some library file. But unable to recognize the same at the moment. Any inputs is highly appriciated.

error: #error "must define number of sample times, NUMST"
error: #error "must define NCSTATES"
error: 'NUMST' undeclared here (not in a function)
Etan Reisner
  • 77,877
  • 8
  • 106
  • 148
Be_bro
  • 15
  • 1
  • 5
  • Are those values that are supposed to have defaults or are you supposed to give them values for your usage/scenario? – Etan Reisner Dec 04 '14 at 14:04
  • They are supposed to be default. I believe these values are fetched from the compiler during auto code generation. I do get the values of NUMST = 1 and NCSTATES = 0 in my make file. But the same values are not reflected in this .c file. Hence the Error. – Be_bro Dec 04 '14 at 14:39
  • 1
    They are probably expected to be passed via `-D` during compilation if they are variables in the makefile. I wonder why that isn't happening. Did you modify the makefile at all? – Etan Reisner Dec 04 '14 at 14:42
  • Ya, I have changed the make file to include a new file along with the auto generated code. I believe I have missed to include some library file in this new file. Hence I get the above error when I try to run this make. – Be_bro Dec 04 '14 at 14:51
  • The error appears to be about undefined macros. It certainly has nothing to do with library files. It is possible that MATLAB generated a header file that you are intended to modify by filling in values for these (and possibly other) macros. Else you must be expected to provide definitions for them in the Makefile or on the command line. – John Bollinger Dec 04 '14 at 14:52
  • Thanks John for the input. They are macros in deed. But I still believe they should somehow get values from make during compilation. For example, the main.c file used for generic real time target(grt.tlc) also has these macros but compiles normally when make file is run. – Be_bro Dec 04 '14 at 15:20
  • What did you modify exactly? Can you show the makefile (or the relevant parts of it)? – Etan Reisner Dec 04 '14 at 15:47
  • Hi all, thanks for your help. I had removed rt_sim.o and rt_nonfinite.o in the template make file which caused this error. adding the files rt_sim.o and rt_nonfinite.o in back in .tmf file resolved the issue. Thanks again. – Be_bro Dec 08 '14 at 08:49

1 Answers1

0

I had removed rt_sim.o and rt_nonfinite.o in the template make file which caused this error. adding the files rt_sim.o and rt_nonfinite.o in back in .tmf file resolved the issue. Thanks again. – Be_bro

Armali
  • 18,255
  • 14
  • 57
  • 171