xcode c++ sqlite3 symbol(s) not found for architecture x86_64 -
hi want use sqlite in c++ project in xcode 4
now getting error
ld /users/jayb/library/developer/xcode/deriveddata/ems-bpigynlzjbrescadebhoiupqmtkg/build/products/debug/ems normal x86_64 cd /users/jayb/documents/developement/ems/ems setenv macosx_deployment_target 10.8 /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.8.sdk -l/users/jayb/library/developer/xcode/deriveddata/ems-bpigynlzjbrescadebhoiupqmtkg/build/products/debug -f/users/jayb/library/developer/xcode/deriveddata/ems-bpigynlzjbrescadebhoiupqmtkg/build/products/debug -filelist /users/jayb/library/developer/xcode/deriveddata/ems-bpigynlzjbrescadebhoiupqmtkg/build/intermediates/ems.build/debug/ems.build/objects-normal/x86_64/ems.linkfilelist -mmacosx-version-min=10.8 -o /users/jayb/library/developer/xcode/deriveddata/ems-bpigynlzjbrescadebhoiupqmtkg/build/products/debug/ems
undefined symbols architecture x86_64: "_sqlite3_close", referenced from: _main in main.o "_sqlite3_errmsg", referenced from: _main in main.o "_sqlite3_open", referenced from: _main in main.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation)
and found linker problem may fix compiler option -lsqlite3
but, how can add option in xcode??????
i use "run" button on xcode 4.4 compile project. not compiling in terminal window.
this code
#include <iostream> #include <stdlib.h> #include <stdio.h> #include <sqlite3.h> using namespace std; int main() { sqlite3 *db; int rc = sqlite3_open("emsdb", &db); if (rc) { fprintf(stderr, "can't open database: %s\n", sqlite3_errmsg(db)); exit(0); } else { fprintf(stderr, "opened database successfully\n"); } sqlite3_close(db); return 0; }
i found way, wish helps looking same solution. builds correct , can see output
woops, cannot post image yet :(
from xcode build settings, can find tab called (linking) , on linking tab there field call 'other linker flags' added -lsqlite3 both debug, , release
cheers
Comments
Post a Comment