| Summary: | Wrong compilation errors | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Germano Massullo <germano.massullo> |
| Component: | cdt-other | Assignee: | Doug Schaefer <cdtdoug> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | critical | ||
| Priority: | P3 | CC: | malaperle |
| Version: | 8.1.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Err, I forgot to delete the for cycle, please remove it from the code listing, or the example will not work Did you try adding the -rt flag to the linker settings? CDT compiles and links in two separate steps. > Did you try adding the -rt flag to the linker settings? CDT compiles and links > in two separate steps. Yes, now it works(In reply to comment #2) |
Build Identifier: 8.0.0.201109151620 I was programming a very simple program using CDT 8.0 plugin in Eclipse, when at line if(timer_create(_POSIX_MONOTONIC_CLOCK, &sigeventStruct, &numero1) == -1) I got “undefined reference to `timer_create' ” error, so the compiling action stopped. The flag of C compiler used in Eclipse are -O0 -g3 -Wall -c -fmessage-length=0 -lrt -std=gnu99 If you open bash and enter gcc timer.c -o prova -O0 -g3 -Wall -fmessage-length=0 -lrt -std=gnu99 it will work without errors, so the problem is Eclipse CDT. Here down the full code example #include <string.h> #include <stdio.h> #include <fcntl.h> #include <time.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #include <signal.h> int main() { timer_t numero1; struct sigevent sigeventStruct; sigeventStruct.sigev_notify = SIGEV_SIGNAL; if(timer_create(_POSIX_MONOTONIC_CLOCK, &sigeventStruct, &numero1) == -1) { printf( "Errore: %s\n", strerror( errno ) ); } for(int i = 0; i < 100; i++) { printf("Test\n"); clearerr(); } return 0; } Reproducible: Always Steps to Reproduce: 1. Start a new C project. 2. Modify gcc flags by adding -lrt -std=gnu99 3. Compile