473,385 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Sqlite3 and C++

158 100+
I am trying to just do a test of sqlite3 and C++ but I having touble.

I am compiling on Mac OS X.


Program:
<code>

#include <iostream>
using namespace std;

#include <sqlite3.h>
sqlite3* db;
char* db_err;

int main() {
sqlite3_open("testDB.sql", &db);
sqlite3_exec(db, "create table 'helloworld' (id integer);", NULL, 0, &db_err);
sqlite3_close(db);
}
</code>



Output:

**** Build of configuration Debug for project HelloWorld ****

make all
Building file: ../src/HelloWorld.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/HelloWorld.d" -MT"src/HelloWorld.d" -o"src/HelloWorld.o" "../src/HelloWorld.cpp"
Finished building: ../src/HelloWorld.cpp

Building target: HelloWorld
Invoking: MacOS X C++ Linker
g++ -o "HelloWorld" ./src/HelloWorld.o
Undefined symbols:
"_sqlite3_open", referenced from:
_main in HelloWorld.o
"_sqlite3_close", referenced from:
_main in HelloWorld.o
"_sqlite3_exec", referenced from:
_main in HelloWorld.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [HelloWorld] Error 1
Jul 6 '09 #1
5 6191
JosAH
11,448 Expert 8TB
There must be a sqllite3 library somewhere; feed that to your linker in the last stage of the build; check your manuals how to do that.

kind regards,

Jos
Jul 7 '09 #2
RedSon
5,000 Expert 4TB
There is no library for SQLite if you are using the SQLite amalgamation file. You must add SQLite.c to your build so that the symbols are created properly. Your linker is complaining that it doesnt know what "_sqlite3_open", "_sqlite3_exec" and "_sqlite3_close" mean.
Jul 9 '09 #3
kardon33
158 100+
Thanks all, I did get it working. I switched to a new IDE and thought they were linked but it wasnt.
Jul 10 '09 #4
tvnaidu
365 100+
Can I compile sqlite3 calls with C code and run on Redhat Linux machine?. thanks.
Jan 18 '10 #5
RedSon
5,000 Expert 4TB
The source code is available for free. You should be able to answer that question for yourself.
Jan 18 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Harold Shore | last post by:
From the release notes I read that "If you're compiling the Python source yourself, note that the source tree doesn't include the SQLite code, only the wrapper module. You'll need to have the...
2
by: John Machin | last post by:
Apologies in advance if this is a bit bloggy, but I'd like to get comments on whether I've lost the plot (or, more likely, failed to acquire it) before I start reporting bugs etc. From "What's...
66
by: mensanator | last post by:
Probably just me. I've only been using Access and SQL Server for 12 years, so I'm sure my opinions don't count for anything. I was, nevertheless, looking forward to Sqlite3. And now that gmpy...
2
by: Josh | last post by:
Hi, I'm running into a problem when trying to create a view in my sqlite database in python. I think its a bug in the sqlite3 api that comes with python 2.5. This works as expected: conn =...
3
by: cjl | last post by:
P: I am using python 2.5.1 on windows. I have the following code: conn = sqlite3.connect('.\optiondata') c = conn.cursor() try: c.execute('''create table options (ssymbol text, strike real,...
4
by: Simon | last post by:
I installed the source code on unix for python 2.5.1. The install went mainly okay, except for some failures regarding: _ssl, _hashlib, _curses, _curses_panel. No errors regarding sqlite3....
0
by: Josh Ritter | last post by:
A number of our Windows customers have an issue with the sqlite3 module included with Python 2.5.1 We've tracked the problem down to the sqlite3.dll included with the Python 2.5.1 distrubtion. ...
3
by: milan_sanremo | last post by:
I have sqlite installed, but when I try to import sqlite3 I receive: Python 2.5.1 (r251:54863, Nov 3 2007, 02:54:36) on sunos5 Type "help", "copyright", "credits" or "license" for more...
0
by: Ben Lee | last post by:
hi folks -- a quick python and sqlite3 performance question. i find that inserting a million rows of in-memory data into an in-memory database via a single executemany() is about 30% slower...
15
by: Kurda Yon | last post by:
Hi, I try to "build" and "install" pysqlite? After I type "python setup.py build" I get a lot of error messages? The first error is "src/ connection.h:33:21: error: sqlite3.h: No such file or...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.