Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have answered your own question, if you get undefined references to MySQL, you are not linking it correctly. You need to compile with:</p> <pre><code>gcc -o a $(mysql_config --cflags) saveUser.c $(mysql_config --libs) </code></pre> <p>This has nothing to do with how your code looks/works, only how the compiler/linker combines the source files into an executable. If you post a part of your Makefile instead of your code maybe you could get more pointers on the issue.</p> <p>EDIT: Ok, can you add <code>$(mysql_config --cflags) $(mysql_config --libs)</code> to your CFLAGS declaration in Makefile.basic and see what happens?</p> <p>EDIT2: The line causing the error seems to be:</p> <pre><code> /usr/bin/gcc -g -Wall -I/usr/include/mysql -DBIG_JOINS=1 -fPIC -fno-strict-aliasing -Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient -static -o cgi_main cgi_func.o cgic.o -lcgi_util -lcgi_module -lutil -L../../lib -lm </code></pre> <p>A bit odd, since (I assume) the correct libraries are linked (<code>-lmysqlclient</code>)... double check that you don't have multiple versions of the mysql library installed, or that these functions are defined in a different library. The easiest way to go about it would be to create a minimal project with just these mysql-functions and try to link it. If that doesn't work there is your problem. If it does work I'm not sure where to go next.</p> <p>You should look into these multiple definitions warnings by the way, looks nasty... check if you have global variables defined in a header file somewhere. The project you are working on seems to partition all it's code in different libraries and link these at the end, maybe you need to clean all of it (remove .o and .a files) and run make again?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload