gemforce-team / gemforce

Gem combining program for GC2:CS and GC:FW
MIT License
28 stars 9 forks source link

Compile error #3

Closed djaenecke closed 8 years ago

djaenecke commented 8 years ago

Hi,

when trying to compile your code I get

$ make
gcc -std=gnu11 -Wall -Wextra -O3 -flto -fwhole-program -I "include/" -lm managem/leechquery.c -o managem/leechquery
In file included from managem/leechquery.c:9:0:
include/gfon.h: In function 'pool_from_table':
include/gfon.h:99:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
  fscanf(table, "%d\n", &pool_zero);        // get pool_zero
        ^
include/gfon.h:105:9: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
   fscanf(table, "%*[^\n]\n");
         ^
include/gfon.h:107:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
  fscanf(table, "%d\n\n", &i);              // check iteration number
        ^
include/gfon.h:118:11: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
     fscanf(table, "%8s %8s %8s\n", b1, b2, b3);
           ^
include/gfon.h:132:10: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
    fscanf(table, "%d\n\n", &iteration_check);    // check iteration number
          ^
/tmp/ccuMeMnn.ltrans1.ltrans.o: In function `main':
<artificial>:(.text.startup+0xa23): undefined reference to `log'
<artificial>:(.text.startup+0xa38): undefined reference to `log'
<artificial>:(.text.startup+0xb2e): undefined reference to `log'
<artificial>:(.text.startup+0xb3f): undefined reference to `log'
<artificial>:(.text.startup+0xbe6): undefined reference to `log'
/tmp/ccuMeMnn.ltrans1.ltrans.o:<artificial>:(.text.startup+0xc04): more undefined references to `log' follow
collect2: error: ld returned 1 exit status
make: *** [managem/leechquery] Error 1

Any idea how to resolve this?

Thanks…

12345ieee commented 8 years ago

Well, your compiler is paranoid and wants me to explicitly check the return value of scanf each time (which has its merit, mind you). Then it has problems linking, and that has something to do with your libraries.

What platform are you on? Are you by chance using a C++ compiler to compile it?

I can whip up a quick fix for scanf, but the log issue is probably on you.

12345ieee commented 8 years ago

Ok, I also found about the log issue, you probably have an old compiler.

I'll fix them both in a couple hours.

12345ieee commented 8 years ago

Fixed (hopefully).

djaenecke commented 8 years ago

Thanks for fixing that fast!

It did, however, still not work with my default gcc (4.8.4); but using gcc-5.4 I managed to compile the code.

Thanks a lot!

12345ieee commented 8 years ago

Seems you are right, gcc 4.8.4 (Ubuntu 14.04) likes to complain a lot.

I've fixed all the remaining issues, thanks for reporting.