2007年6月7日星期四

linker input file unused because linking not done

我在Windows下使用SQLite编了个C++程序,在编写Makefile并使用cygwin 中的 g++进行编译链接时遇到如下的错误:
linker input file unused because linking not done
我的语句是 g++ -c a.cpp -lsqlite3

到网上查了一下,问题出在链接数据库的语句不应出现在编译语句里面。 上面的语句里面有 -c 即编译 compile,所以命令会忽略掉所有的 -l 链接库的命令。

而要链接数据库,应该在生成可执行文件时才使用。
正确的使用链接的语句应该是 g++ a.o -L. -lsqlite3 -o exename

1 条评论:

匿名 说...

My partner and I absolutely love your blog and find a lot of your post's to be precisely what I'm
looking for. Do you offer guest writers to write content
for you personally? I wouldn't mind creating a post or elaborating
on many of the subjects you write about here. Again, awesome blog!


Feel free to surf to my weblog: wellmate wm-6