mercredi 3 juin 2015

Include a database file in library file for SDK

I'm not sure if its possible to do this or not. So please be considerate and dont mark question as vague. I have a decent understanding of C#. I've been asked to make a SDK along with our program so that a customer can make his own UI using our functions. In C#, I did this by adding a DLL. I had to use a database file(.db) to hold commands. But it went successfully. Now I've been asked to do the same in C++. I'm very new to C++. But here's what I read from msdn and did:

  1. I created a library project.
  2. Added database as a resource file, sqlite3 header file and library file(I got from giving lib command on command prompt).
  3. Created a header file with functions and wrote in a .cpp file with all function definitions.
  4. Built it, the got library file from lib command.

So far, so good. Now when I try to use this library file and header, I'm getting the following errors during build time( Not sure what its called. Sorry :( )

error C2059: syntax error : '<'
error C2018: unknown character '0x7'
error C2018: unknown character '0x60'
error C2018: unknown character '0x7'
error C2018: unknown character '0x2'
error C2018: unknown character '0x1e'
error C2018: unknown character '0x18'

I struggled with this for sometime when I remembered that these errors were the same I got a few days ago. I actually asked the question in SE and got the answer (Error while including database file in C++ project).

So I inferred that the compiler is trying to read the database file saved in the library file and hence I got these errors.

Now I have two questions. 1. Am I right? Is the compiler trying to read the .db file stored in .lib file? 2. If so, can anyone please give any suggestions 3. Also, if you think I'm wrong, I would appreciate any other explanations.

I'm using visual express C++ 2010. I used command prompt that comes with visual studio to create .lib file. My reference for creating .lib file was http://ift.tt/1KDy7DM.

Thank you.

Aucun commentaire:

Enregistrer un commentaire