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.

question on the pragma with C++

I attempted to define the functions in a C++ file using, #pragma CODE_SECTION(fun_name, “SECTION_NAME").  But I got the error, such as "MsgHandler.cpp", line 853: error: badly formed pragma

I tried the same thing in a C file in the same project but did not get an error. Please let me know what you think.

Regards

Mohsen

  • The syntax for pragmas differs between C and C++.

    The syntax of the pragma in C is:

       #pragma CODE_SECTION(symbol, "section name")

    The syntax of the pragma in C++ is:

       #pragma CODE_SECTION("section name)

    where the pragma immediately precedes the declaration of the symbol to which it applies.