我有一個靜態庫libsqlite3.a,我想鏈接到我的小程序。 我make文件如下圖所示:無法鏈接到SQLite3靜態庫
CPP = g++
sources = main.cpp
objects = main.o
included = -IC:/SQLite-lib/include
linked = -LC:/SQLite-lib/ -lsqlite3
main : $(objects)
$(CPP) $(linked) $(objects) -o main
main.o : $(sources)
$(CPP) $(included) -c main.cpp
我不斷收到這樣的錯誤信息:
g++ -LC:/SQLite-lib/libsqlite3.a main.o -o main
main.o:main.cpp:(.text+0x42): undefined reference to `sqlite3_open'
main.o:main.cpp:(.text+0x7d): undefined reference to `sqlite3_close'
main.o:main.cpp:(.text+0xe7): undefined reference to `sqlite3_close'
collect2: ld returned 1 exit status
make: *** [main] Error 1
我在做什麼錯?我使用Win XP SP3,GCC 4.6.2。
makefile和輸出不匹配! – 2012-02-09 09:54:01