Find the answer to your Linux question:
Results 1 to 2 of 2
when we have added mysql access code and thread in a single c program, how can we complie it? because for mysql we write gcc -I/usr/include/mysql <c filename> -L/usr/lib/mysql -lmysqlclient ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2005
    Posts
    17

    dual compilation


    when we have added mysql access code and thread in a single c program,
    how can we complie it?

    because
    for mysql we write
    gcc -I/usr/include/mysql <c filename> -L/usr/lib/mysql -lmysqlclient -lz -o <binary c file>

    and for threads

    cc I/usr/include/nptl <c filename> -L/usr/lib/nptl -lpthread -o <binary c file>

    how can i combine these 2 in one command to compile it.

    thanx in advance

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    That's quite easy. Just combine them into one:
    Code:
    gcc -I/usr/include/mysql -I/usr/include/nptl c-file -L/usr/lib/mysql -L/usr/lib/nptl -lpthread -lmysqlclient -lz -o output.o
    However, do you really need "-I/usr/include/nptl" and "-L/usr/lib/nptl"? On my system, I don't even have those directories, and if you use any functions or functionality that is specific to NPTL, you won't be able to compile your program on other pthread implementations.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •