Fallenreaper
Fallenreaper

Reputation: 10704

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)

Upvotes: 1

Views: 160

Answers (2)

CL.
CL.

Reputation: 180080

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.)

Upvotes: 2

mmmmmm
mmmmmm

Reputation: 32681

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

Upvotes: 3

Related Questions