Trouble Compiling c++ file on Linux platform and eclipse IDE

Tim Prince n8tm@aol.com
Thu Feb 2 20:59:00 GMT 2012


On 2/2/2012 3:31 PM, Jonathan Wakely wrote:
> On 02/02/2012, rebelstar wrote:
>>
>> Hello,
>>
>> I have a C file and .h file which i can easily compile on a 64 bit linux
>> platform.( Through eclipse IDE. In the compiler option, i enable -std=c99.
>>
>>
>> Now, with the same file, i want to compile it on c++ compiler. (the gcc
>> compiler version i am using is 4.2.2)
>>
>> So i add extern c to the .h files and rename the .c file to c++.
>> I used g++ compiler when i got the error " enable c99 compiler option.
>
> That doesn't look like a GCC error, what's the exact message?
>
> Have you taken -std=c99 out of the options? That's not valid for compiling C++
>
> You should not need any -std option.
If you set -std=c99 in order to enable restrict, you may need 
-Drestrict=__restrict__ (or equivalent substitution in .h) when you 
switch to C++ and remove -std=c99.

-- 
Tim Prince



More information about the Gcc-help mailing list