我想在 Ubuntu 上使用 SQLite 和 c++。我选择尝试https://www.sqlite.org/quickstart.html中的示例。但是在运行时c++ test.cpp -o test
出现错误:
/tmp/ccTwwjKw.o: In function `main':
test.cpp:(.text+0xf1): undefined reference to `sqlite3_open'
test.cpp:(.text+0x106): undefined reference to `sqlite3_errmsg'
test.cpp:(.text+0x12e): undefined reference to `sqlite3_close'
test.cpp:(.text+0x15d): undefined reference to `sqlite3_exec'
test.cpp:(.text+0x18f): undefined reference to `sqlite3_free'
test.cpp:(.text+0x19b): undefined reference to `sqlite3_close'
collect2: ld gab 1 als Ende-Status zurück
我认为问题与此处相同:Sqlite undefined reference to `sqlite3_open' error in Netbeans C++ on Ubuntu, Integrating SQLite into Netbeans C++ Ubuntu。但是我没有make文件,也不使用netbeans。