Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » eclipse c/c++ developer IDE c11 _Generic(why eclipse generate errors for c11_Generic code )
eclipse c/c++ developer IDE c11 _Generic [message #1432775] Sat, 27 September 2014 18:19
belal medhat is currently offline belal medhatFriend
Messages: 1
Registered: September 2014
Junior Member
Hi
i have a question
i am writing code using C11 _Generic new features i am working on Ubuntu 14.04 LTS and eclipse luna c/c++ developer IDE
first there was errors because ubuntu 14.04 gcc 4.8.2 not support _Generic c11 features but i have dist-upgrade to ubuntu 14.04.1 with new default gcc 4.9 which support c11 _Generic and i have build the code and compile and run it work well but the eclipse IDE still mark the syntax as errors

here is the code and i have attached print screen to the eclipse ide with errors marks

#include <stdio.h>
#include <math.h>
#define RAD_TO_DEG (180/(4 * atanl(1)))

// generic square root function
#define SQRT(X) _Generic((X),\
long double: sqrtl, \
default: sqrt, \
float: sqrtf)(X)

// generic sine function, angle in degrees
#define SIN(X) _Generic((X),\
long double: sinl((X)/RAD_TO_DEG),\
default: sin((X)/RAD_TO_DEG),\
float: sinf((X)/RAD_TO_DEG)\
)

int main(void)
{
float x = 45.0f;
double xx = 45.0;
long double xxx =45.0L;

long double y = SQRT(x);
long double yy= SQRT(xx);
long double yyy = SQRT(xxx);
printf("%.17Lf\n", y); // matches float
printf("%.17Lf\n", yy); // matches default
printf("%.17Lf\n", yyy); // matches long double
int i = 45;
yy = SQRT(i); // matches default
printf("%.17Lf\n", yy);
yyy= SIN(xxx); // matches long double
printf("%.17Lf\n", yyy);

return 0;
}


the errors say symbol y cannot be resolved
Previous Topic:Configuring CDT
Next Topic:Github import / AVR Toolchain link
Goto Forum:
  


Current Time: Fri Apr 26 19:22:56 GMT 2024

Powered by FUDForum. Page generated in 0.03084 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top