2013年9月6日星期五

Ask questions

Makefile I now have two files , test.c mmysql.c one of which is operating mysql database , now every time you compile
gcc-o test $ (mysql_config - cflags) mmsql.c test.c $ (mmsql_config - libs)
because of the Makefile is not familiar with, so ask how to write Makefile
Thank
------ Solution ----------------------------------- ---------
most direct and simple

all:
        gcc -o test $(mysql_config --cflags) mmsql.c test.c $(mmsql_config --libs)

clean:
        rm -f test


smart point :

TARGET := test

all : ${TARGET}

test: mmsql.c test.c
        echo $^
        gcc -o $@  $(mysql_config --cflags) $^ $(mmsql_config --libs)

clean:
        rm -f test


------ For reference only ---------------------------------------
required documents
test.c
mmsql.c
mmsql.h

test.c mmsql.c then compiled header file to include mmsql.h
------ For reference only ----------------- ----------------------

tried it , the compiler does not pass , fatal error : mysql.h: no such file or directory but thank you for giving me ideas
------ For reference only ------------------------------ ---------
problem has been resolved , interested students can look at my blog

没有评论:

发表评论