Hi C experts,
In my code I have got
#pragma extern_prefix (push, "");
Some extern function declarations
#pragma extern_prefix (pop, "");
So that compiler does not prepend anything to those extern functions , I get an error

error #14: extra text after expected end of preprocessing directive

Does anyone know how to fix this syntax error ?

Re: How to fix extra text after expected end of preprocessing directive ? 80 80

What C compiler are you using? What's this pragma format description in the compiler manuals?

Re: How to fix extra text after expected end of preprocessing directive ? 80 80

Hi C experts,
In my code I have got
#pragma extern_prefix (push, "");
Some extern function declarations
#pragma extern_prefix (pop, "");
So that compiler does not prepend anything to those extern functions , I get an error

error #14: extra text after expected end of preprocessing directive

Does anyone know how to fix this syntax error ?

I may be wrong but if this pragma is acting as preprocessor directive then it should not have any ";" at its end. Right?
(Even the error coming is also showing that...)

Re: How to fix extra text after expected end of preprocessing directive ? 80 80

A semicolon can be useful in some preprocessor commands (probably some bizarre scenario), for example its perfectly valid in a #define statement. In this case we do need to know the compiler and its definition of #pragma because its functionality is not standard.

Re: How to fix extra text after expected end of preprocessing directive ? 80 80

#pragma extern_prefix (push, "")
#pragma extern_prefix (pop) worked , marking it as solved.

Re: How to fix extra text after expected end of preprocessing directive ? 80 80

A semicolon can be useful in some preprocessor commands (probably some bizarre scenario), for example its perfectly valid in a #define statement. In this case we do need to know the compiler and its definition of #pragma because its functionality is not standard.

Well according to my knowledge semicolons are not used in any of the preprocessor directives because of the fact that preprocessor directives are mostly used within the coding statements and the appearance of ";" would mark the end of that statement.

Re: How to fix extra text after expected end of preprocessing directive ? 80 80

I didn't say it was a good idea, but the real question here was about the compile error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.