This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]