I'm new to objective c & c. I'm trying to use this random generator c library in an objective c program. My understanding is that objective c is a strict superset of c so this should be possible.
My code compiles and runs but I get a lot of warnings.
uint32_t * (aka unsigned int *) with an expression of type intI have not imported the C header file to the objective c class - it just finds it. If I import it I get duplicate method errors.
C library header file:
extern void mt_seed32(uint32_t seed);
extern uint32_t mt_lrand(void);
Code to call it: [I've tried calling it with [self method()] but that crashes
mt_seed32(3);
uint32_t *i = mt_lrand();
Can anyone tell me how too get rid of these warnings?
The last compiler error happens because mt_lrand(); returns an int, not a pointer to an int. Therefore, the last line should be
uint32_t i = mt_lrand();
All the other errors are due to the fact that you did not #include the library header. Could you please post the errors that occur when you do include the library header?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With