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.

Compiler/MSP430F1491: CCS Error #18 expected a ")" in stdlib.h

Genius 12760 points
Part Number: MSP430F1491


Tool/software: TI C/C++ Compiler

I'm trying to convert an old MSP430F1491 IAR embedded workbench project to CCS 9.2 and I'm getting some errors that I don't know how to solve.

The compiler tells me that there are missing brackets in stdlib.h

on these lines specifically:

typedef int (*__TI_compar_fn)(const void *_a,const void *_b);
_CODE_ACCESS int    mblen(const char *_s, size_t _n);
_CODE_ACCESS size_t mbstowcs(wchar_t * __restrict _dest, const char * __restrict _src, size_t _n);
_CODE_ACCESS int    mbtowc(wchar_t * __restrict _dest, const char * __restrict _src, size_t _n);
_CODE_ACCESS size_t wcstombs(char * __restrict _dest, const wchar_t * __restrict _src, size_t _n);
_CODE_ACCESS int    wctomb(char *_s, wchar_t _wc);

I searched the internet and some people have had similar problems. It may have something to do with duplicate implementations of the functions mblen(), mbstowcs() etc… but I have not been able to find a solution.

Regards Bernd

  • I suspect something else is wrong before those lines in stdlib.h, but that's where it finally shows up.  The preprocessor listing is usually the best way to find problems like this.  Please add the option --gen_preprocessor_listing and build again.  The preprocessor listing file has the same name as the source file, with the extension changed to .rl.  I think you will find it in the Debug directory (or whatever the name of the current build configuration is), but you might find it in the same directory as the source file.  To understand the contents of this file, please search for --gen_preprocessor_listing in the ARM compiler manual.  The important point is you can see source lines before and after preprocessing.  I suspect that will show you the root cause of the problem.

    If you are still confused, then please attach the .rl file to your next post.  So the forum will accept it, add the file extension .txt.  In addition, tell me the version of the compiler (not CCS).  And show the entire invocation of the compiler on the problem source file, by copy-n-paste of the text from the Console view.  Please do not attach a screen shot.

    Thanks and regards,

    -George

  • Hello George,

    thank you for the hints. The issue is solved now and the project builds without errors.

    Regards Bernd