简体   繁体   中英

i was adding offocial SQLite source code to my C++ project and gets a linker error

What sort of linking error is this referring to within my C++ project? The only thing that i am thinking of is that the SQLite3 header is a part of the project.

duplicate symbol _main in:
/Users/.../Build/Intermediates/AssetInspector.build/Debug-iphoneos/AssetInspector.build/Objects-normal/armv7/main.o
/Users/.../Build/Intermediates/AssetInspector.build/Debug-iphoneos/AssetInspector.build/Objects-normal/armv7/shell.o
ld: 2 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The issue is that the function main is defined both in main.c and shell.c.

You should only link with one of those object files from those .c files and not both

When compiling the SQLite amalgamation into your project, use only the sqlite3.c file. The other files are not needed. ( shell.c is the source code of the sqlite3 command-line tool.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM