头文件路径:Z:\include\curl\curl.h
库路径:Z:\lib\libcurl.so
liunx下面我们项目的根路径:/usr/local/icache/
/* 就是说头文件其实是在 /usr/local/icache/include\curl\curl.h include和 TCPtest在同一目录下*/
代码目录::/usr/local/icache/TCPtest
Makefile:
#(c) CETC 2007
ROOTDIR=.
CC=gcc
ICACHE_ROOT=/usr/local/icache/
LIB_PATH=
LIBS+=-lcurl -lpthread
INC=-I./ -I$(ICACHE_ROOT)/include/
CFLAGS = -g -O2 -DLINUX -Wall -pipe #`pkg-config --cflags --libs glib-2.0 gthread-2.0`
OBJ_CLIENT = $(ROOTDIR)/*.o
default:all
%.o:%.c
echo compiling $@
$(CC) $(WFLAGS) $(CFLAGS) $(IFLAGS) -c {1}lt;
all:test
test: $(OBJ_CLIENT)
$(CC) -o test $(OBJ_CLIENT) $(LIB_PATH) $(LIBS) $(CFLAGS) $(IFLAGS) $(INC)
PHONY: clean
clean:
rm *.o -rf
rm test -f
报错:
g++ -c -o *.o TestRss.cpp
TestRss.cpp:3:23: error: curl/curl.h: No such file or directory
TestRss.cpp: In function ‘void* http_get(void*)’:
TestRss.cpp:56: error: ‘CURL’ was not declared in this scope
TestRss.cpp:56: error: ‘curl’ was not declared in this scope
TestRss.cpp:57: error: ‘CURLcode’ was not declared in this scope
TestRss.cpp:57: error: expected `;' before ‘res’
TestRss.cpp:59: error: ‘curl_easy_init’ was not declared in this scope
TestRss.cpp:64: error: ‘CURLOPT_HEADERDATA’ was not declared in this scope
TestRss.cpp:64: error: ‘curl_easy_setopt’ was not declared in this scope
TestRss.cpp:66: error: ‘CURLOPT_HEADERFUNCTION’ was not declared in this scope
TestRss.cpp:69: error: ‘CURLOPT_URL’ was not declared in this scope
TestRss.cpp:76: error: ‘res’ was not declared in this scope
TestRss.cpp:76: error: ‘curl_easy_perform’ was not declared in this scope
TestRss.cpp:80: error: ‘curl_easy_cleanup’ was not declared in this scope
TestRss.cpp: In function ‘int main(int, char**)’:
TestRss.cpp:87: error: ‘CURLcode’ was not declared in this scope
TestRss.cpp:87: error: expected `;' before ‘res’
TestRss.cpp:98: error: ‘res’ was not declared in this scope
TestRss.cpp:98: error: ‘CURL_GLOBAL_ALL’ was not declared in this scope
TestRss.cpp:98: error: ‘curl_global_init’ was not declared in this scope
TestRss.cpp:99: error: ‘CURLE_OK’ was not declared in this scope