Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
2,005 Views

How to setup sqlite3 for Intel Edison using Eclipse C/C++

I'd like to use sqlite3 in an Intel Edison project using Eclipse C/C++ and mraa etc.

sqlite3_open is showing undefined.

# include

int main() {

sqlite3 *db;

int rc;

rc = sqlite3_open("/media/Database/myData.db3", &db);

// bla bla

}

thanks in advance

Tom

0 Kudos
8 Replies
Highlighted
Community Manager
22 Views

Hello TGunthorpe,

 

 

First, I would like to ask you if you have tried Eclipse's official guide to add SQLite (https://wiki.eclipse.org/Connecting_to_SQLite Connecting to SQLite - Eclipsepedia ). And if you did, how did it go? Did you have any error messages or anything that could be of help?

 

 

I would also like to ask you which OS are you running Eclipse on? As you might imagine, it's not the same thing on Windows, Linux or OSX.

 

 

Let me know.

 

-Peter.
0 Kudos
Highlighted
Beginner
22 Views

Hi Peter,

Thank you for your reply. I had a look at the thread link - and I think you posted the wrong link. It's nothing to do with sqlite.

To answer your questions, I'm using Intel System Studio IOT Edison - Eclipse C/C++ out of the box on Windows 10. All of my code is written in C using mraa for the Intel Edison. I would now like to link in the sqlite3 database into my Eclipse project. The original error message is: undefined reference to sqlite_open

I know the problem is not syntax or code - it's that Eclipse is not aware of the sqlite3 pre-compiled library.

Since posting the original question - on another forum I've been given help to compile and link in sqlite directly on the Edison using: gcc main.c -l sqlite -l mraa

This works, but is not my preferred method of building my system. I would like to stay completely within Eclipse. Just like doing a Google search - it comes down to knowing what question to ask.

I hope that my question is now a little more clear - and if there was a mistake with the thread link - I'd be very keen to look.

-Tom

0 Kudos
Highlighted
Community Manager
22 Views

I apologize, you are correct, I posted the wrong link, it is now corrected.

The method you were provided in the other thread is in fact the one that I prefer as it avoids some issues that occasionally appear when using Eclipse.

If you would like to only use Eclipse, then you will have to add the sqlite libraries to Eclipse. It needs to identify the libraries on the IDE in order to know that there's no issues with the code and to make sure everything runs smoothly on the IDE. You will also need sqlite on Edison as it is where it'll end up actually running.

Try the guide in the link above (now corrected) and let us know how it goes.

 

-Peter.
0 Kudos
Highlighted
Community Manager
22 Views

Hi Tom,

 

 

I was wondering if you still need help with this. Please let us know if you were able to try the guide in the link that Peter suggested you.

 

 

Regards,

 

-Diego
0 Kudos
Highlighted
Beginner
22 Views

Hi Diego,

The answer is that if I want to use sqlite3 I must copy my source to the Edison and 'make' directly on the Edison. Unfortunately that means that I can only use Eclipse as a text editor. All calls to the sqlite3 are # if def out in Eclipse , and # if def in on the Edison. Putting the sqlite3 libraries into Eclipse is a nightmare - if someone has done this, it would be great if a step-by-step instruction manual was created to manage all of the # if everything's through the build.

-Tom

0 Kudos
Highlighted
Community Manager
22 Views

0 Kudos
Highlighted
Beginner
22 Views

Hi Peter,

Thank you for your follow up and further details.

What I noticed with each of the examples you've provided is that they are either compiling directly on the target (which I'm able to do also) or they are running on a Linux/Ubuntu operating system. In the second case, they are able to add the sqlite3 library directly into their operating system and reference it from the Eclispe compiler.

I'm running on Windows 10 - which means that I would have to add the sqlite3 source to my project. I tried to do this, and I think you had the same conclusion that it's a minefield due to the exhaustive number of # define and if you're not an expert you'd never figure it out.

Does what I've said make sense? It seems that most of the programmers working in the space are old school and are either on Linux OS or compiling directly. I'm new school and like the GUI's

I'm not sure what the real solution is?

I guess it'll come down to compiling directly on the Edison

or someone with knowledge and skill need to provide clear instructions on how to use the sqlite3 source directly in the Eclipse environment

or an in-built library to Eclipse would be magic.

-Tom

0 Kudos
Highlighted
Community Manager
22 Views

I completely understand your point, however, the process I mentioned above is currently the only way to add it to Eclipse.

 

 

Considering what you have explained so far, it seems that the best approach for your project is to compile directly on Edison. I know this is not the option you prefer, but it would be the easiest one considering the fact that adding sqlite3 to Eclipse is not as straight forward as we wish.

 

 

-Peter.
0 Kudos