CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Jan 2000
    Location
    India, Tamilnadu
    Posts
    279

    sqlite static complie

    hi
    How do I statically link sqlite3 using VC6++? Any samples?

    Thanks
    Eugene

  2. #2
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: sqlite static complie

    Just include the header and amalgamation source file in your project.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  3. #3
    Join Date
    Jan 2000
    Location
    India, Tamilnadu
    Posts
    279

    Re: sqlite static complie

    Could you please provide some more information?
    EUgene

  4. #4
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: sqlite static complie

    1. Go to the SQLite download page.
    2. Download and extract sqlite-amalgamation-3_6_14_2.zip
    3. Move or copy sqlite3.h and sqlite3.c to your desired header and source directories, respectively.
    4. Add sqlite3.h and sqlite3.c as header and source files respectively to your Visual Studio project.
    5. Include sqlite3.h as necessary and write your program.
    6. Build your project.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  5. #5
    Join Date
    Jan 2000
    Location
    India, Tamilnadu
    Posts
    279

    Re: sqlite static complie

    Thanks. I could get it compiled without any errors. I was previousely using one of the codeproject wrapper class where I need to have the dll on the folder. But, opening the database and handling was easy.
    Is there any further samples available on how to open a sample database and execute a query? It will be of great help if I can get a small bit of sample.

    Thanks a lot for your help.
    Regards
    Eugene

  6. #6
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: sqlite static complie

    Quote Originally Posted by AnitaEugene
    Is there any further samples available on how to open a sample database and execute a query? It will be of great help if I can get a small bit of sample.
    You should check out the documentation on the SQLite website.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  7. #7
    Join Date
    Dec 2004
    Posts
    61

    Re: sqlite static complie

    Dear laserlight,

    I was trying to use sqlite library as well.
    I follow you instruction by adding in the 2 file sqlite3.h and sqlite3.c to my project.
    But i get this compilation error:

    [QUOTE]
    all the function in sqlite3 is getting the marco redefinition error.
    [\QUOTE]

    compilation message
    1 error(s), 255 warning(s)
    The error message is: fatal error C1010 : unexpected end of file while looking for precompiled header directive
    what actually when wrong?
    How can i solve this problem


    actually i try another way to create the lib file by using the sqlite3.def and sqlite3.dll
    from the internet, i find a command that show me how to generate the lib file
    from the command promt
    C:\>LIB /def:sqlite3.def
    but also getting error. please refer to attachment.

    How can i use sqlite library? is there any other way?
    Thanks
    Attached Images Attached Images  
    Last edited by VbEndUser; January 29th, 2012 at 12:21 AM.

  8. #8
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: sqlite static complie

    Quote Originally Posted by VbEndUser
    The error message is: fatal error C1010 : unexpected end of file while looking for precompiled header directive
    what actually when wrong?
    How can i solve this problem
    If you don't need pre-compiled headers, maybe the simple solution here is to just disable the feature.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  9. #9
    Join Date
    Dec 2004
    Posts
    61

    Re: sqlite static complie

    Dear laserlight,

    yes. I have disable the pre-compiled headers and the compilation is successful.
    i just not understand the usage of the pre-compiled headers.

    another question here is how can i create the lib file for the sqlite3?
    using def and dll only?
    as i mention in my previous post, i try to use the LIB.exe but still cannot.
    Have you try to compile the sqlite3.lib?
    Thanks.

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: sqlite static complie

    Quote Originally Posted by VbEndUser View Post
    ... i find a command that show me how to generate the lib file
    from the command promt
    C:\>LIB /def:sqlite3.def
    but also getting error. please refer to attachment.
    Well, according to MSDN from October 2000:
    Linker Tools Error LNK1104
    cannot open file "filename"

    The tool could not open the given file.

    Tips

    One of the following may be a cause:
    • There was not enough disk space.
    • The file does not exist.
    • The filename or its path was incorrectly specified.
    • The specified drive is invalid.
    • The file does not have the appropriate permissions.
    • The path for filename expands to more than 260 characters.
    • If the given file is named LNKn, which is a filename generated by the linker for a temporary file, then the directory specified in the TMP environment variable may not exist, or more than one directory is specified for the TMP environment variable. (Only one directory path should be specified for the TMP environment variable.)
    • If the error occurs on the executable filename, an earlier version of the executable may still be running. You will need to terminate the executable before linking it. In Windows NT or Windows 95 you can use the utility PVIEW to look for and kill instances of the application. PVIEW.EXE is shipped with Visual C++.
    • If the error message occurs for a library name, and you recently ported the .MAK file from a previous Microsoft Visual C++ development system, the library may no longer be valid. Ensure that the library still exists in this circumstance.
    Did you check whehter this file sqlite3.def really exists on the drive c:\?
    Victor Nijegorodov

  11. #11
    Join Date
    Dec 2004
    Posts
    61

    Re: sqlite static complie

    Dear VictorN,

    I copy both the file sqlite3.def and sqlite.dll to the LIB.exe folder
    (C:\Program Files\Microsoft Visual Studio\VC98\Bin).
    I did not copy to the c:/ path

    Thanks.

  12. #12
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: sqlite static complie

    But zou started the LIB.exe from the C:\ folder, not from C:\Program Files\Microsoft Visual Studio\VC98\Bin!
    So, either do
    Code:
    cd C:\Program Files\Microsoft Visual Studio\VC98\Bin
    before starting LIB or pass in the full path name of sqlite3.def.
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured