I'm dealing with a somewhat intractable problem. We're running dSPACE 7.4 (RTI 1006) on MATLAB 2011a, which I understand uses the dSPACE DS1006 C Compiler v. 2.2. When I try to compile one of our models, I wind up with a linker error claiming that fscanf is undefined (it's being invoked in a custom function). I have verified that stdio.h is where it should be in the system hierarchy and that it contains a definition for fscanf. Following are the steps I took to try to resolve the problem:
- linker initially complains about undefined fscanf()
- extra definition inserted in model-specific file where I know it will be compiled causes linker to complain about inconsistent definitions for fscanf()
- commenting out fscanf() definition in stdio.h then allows successful compilation/linking
- inserting stub definition into stdio.h and commenting out original (and stub in model-specific file) results in 'multiple definitions of fscanf' errors (this is the weirdest part of the whole story)
The stub definition (I am assured by a higher-up that this shouldn't break our model but I haven't yet had a chance to verify this) is as follows:
int fscanf(int a, char *cp, void *b, ...){return 0;}
So, if I'm reading it correctly it's a version of fscanf that won't actually do what fscanf is supposed to do. In summary, I have to hack my compiler's library to get this model to build, and I'm not entirely confident that it will run on our hardware at present. I also don't want to tell everyone in the office to modify their dSPACE installation and break fscanf unless I know that it works and it's the only way forward.
Can anyone give me some insight on this?
UPDATE: It does indeed run on our hardware. But I don't like breaking fscanf(), so I'd still like to figure this out.