This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

error: expected a type specifier

		
Hi,

Below is an excerpt of code in my header file, which is included in a source file.


.
.
.
double acos(double x);
double atan(double x);
double atan2(double y, double x);
extern double ceil(double x);
double cos(double x); //this is line 11313
double cosh(double x);
.
.
.
However I get error as below only on the last two lines,

"D:/Private/source/rom.h", line 11313: error: expected a type specifier

Similar behaviour is seen on some other lines also. I have migrated my code from CCS 3.3 to CCSv5.1 using the wizard inbuilt. I donot see this error in CCS3.3. I tried interchanging the Error parser options, in vain. Please help me resolve the error.

Regards,
Aadishri
  • Aadishri,

    Is this error generated if you simply compile a C source file with this header file included? If so, could you send the C source file and header file, along with compile options, so we can duplicate the error? Also which device are you building for?

  • Another suggestion to consider ...  Build with --verbose_diagnostics.  This causes the compiler to echo the problem line, with a pointer to where on the line the problem starts.  It might be useful in this case.

    Thanks and regards,

    -George

  • Hi,

    Due to IP constraints, I will not be able to share the source. However,

    1. I can share the build log

    or

    2. If possible you can see the error with VNC. I am placed at TI-Bangalore.

    I tried the verbose option, but it just printed the line also along with line-number , line number was available otherwise also.

    The device is ARM 7, little Endian.

    Thank you,

    Aadishri

  • Also, if I compile another file in the project with the same included file, it compiles

  • The most likely cause of a problem like this is that somewhere in the source code, there is a preprocessor macro definition of the identifier "cos".  You could check this by adding this block just before line 11313:

    #ifdef cos 
    #error "hey, cos is a macro"
    #endif

    You probably do not need these prototypes for the standard math functions.  Just include the RTS library's math.h and that should suffice.

  • Dear Archeologist,

    I commented <math.h> in my source file and it worked!. Thanks for your valuable hint.

    But, I still donot know how it was compiling with ccs 3.3. Infact, I used the error number(#80 for 'expected a type specifier') and the --diag_suppress=num option also on ccsv5, in vain. Any clues on why it worked on CCS3.3?

    Regards,

    Aadishri

  • The most likely scenario is that something changed in the MSP math.h which is incompatible with your source code.  I can't guess what it is without seeing a reproducible test case.  It is a bit alarming to me that you've resolved the problem by removing the include of the standard header file.  This suggests that the prototypes you have in your source code are somehow different than the code in the library, which could lead to subtle (and therefore expensive) bugs.

    Error number 80 is a fatal error; you cannot suppress it.

  • The math.h in ccs3.3 and ccs5.1 are totally different. I replace the math.h file of ccs5.1 with ccs3.3 and it worked!

    Thank you so much for your time.

    Regards,

    Aadishri

  • They are a bit different because the implementation in the library has changed.  If you mix the old math.h with the new library, there is no guarantee it will work correctly.  If it works for you, I suppose I can't tell you not to do it, but it is a completely unsupported use case.  In the long run, I think the best thing to do is to remove the custom prototypes for the C standard library functions and just include math.h