back soft

مطالب مرتبط با «how to compile c» در back soft | نویسنده: استخدام کار

Trying to use clock_t but compiler gods hate me

Vote count: 0 Hello gentlemen and ladies - I'm having a hard time figuring out what is wrong with my code. The compiler keeps getting an implicit declaration of function 'clock'[ -Wimpliciit-fucntion-declaration] clock_t start = clock(); and 'CLOCKS_PER_SEC' undeclared #include #include #define N_TIMES 600000 #define ARRAY_SIZE 10000 int main(void) { double *array = calloc(ARRAY_SIZE, sizeof(double)); double sum = 0; int i; int j; clock_t start = clock(); for (i = 0; i < N_TIMES; i++) { for ( j = 0; j < ARRAY_SIZE; j +=4){ sum += array[j]; sum += array[j + 1]; sum += array[j + 2]; sum += array[j + 3]; } } printf ("%.1f secondsn", (double) (clock() - start) / CLOCKS_PER_SEC); retu 0; } I've b...

ادامه مطلب

How to compile Netcat from source on Eclipse without getting 10 billion errors?

Vote count: 0 OK, maybe not 10 billion. But I'm new to Eclipse and everytime I resolve an error (such as: make: *** No rule to make targetall'. Stop.), a new error pops up (such as:***No rule to make target 'clean'`). Here's what I have: an Eclipse IDE and Netcat 0.7.1 source code from http://sourceforge.mirrorservice.org/n/ne/netcat/netcat/0.7.1/netcat-0.7.1.tar.gz I unzipped the tar and clicked 'Import' in Eclipse to import 'Existing code as Makefile Project'. Next, I gave the project a name and pointed 'src' in the netcat folder as the 'Existing code location'. Now the files are imported in Eclipse. Next I click on 'netcat.c' and h...

ادامه مطلب

How to compile project with clang and the option -std=c++11, using autotools

Vote count: 0 I'm developping a software with C and C++ code. I've recently added some code in c++11 standard. In configure.ac I wrote: for f in '-std=c++11' '-std=c++11 -stdlib=libc++' do AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [], []) ${stdpass-false} && break done if ! "${stdpass-false}"; then AC_MSG_ERROR([Unable to tu on C++11 mode with this compiler]) fi With gcc I've no problem, everything goes well the option -std=c++11 is only applied to g++ and not on gcc. If I try to configure with: CC=clang ./configure I have the following error: checking whether C compiler accepts -std=c++11 -stdlib=libc++... no configure: error: Unable to tu on C++11 mode with th...

ادامه مطلب

برچسب‌های مرتبط

trying to use an errordocument to handle | trying to use a recycled bitmap | trying to use big words | trying to use a rubber tonight | trying to use non-existing surface | trying to use an errordocument to handle the request | trying to use the dummy pstream library | trying to use a network resource that is unavailable | trying to use lure module | trying to use someone else's shower