• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            牽著老婆滿街逛

            嚴(yán)以律己,寬以待人. 三思而后行.
            GMail/GTalk: yanglinbo#google.com;
            MSN/Email: tx7do#yahoo.com.cn;
            QQ: 3 0 3 3 9 6 9 2 0 .

            Accessing SQLite databases in C++ using SOCI

            轉(zhuǎn)載自:http://jameswynn.com/2009/10/accessing-sqlite-databases-in-c-using-soci/

            I recently decided to use SOCI and SQLite at work and found that neither there is not a super straight forward path for setting this up. As of SOCI version 3.0.0 there is no support for Visual Studio 2008, so I had to convert and fix a few bugs resulting from that. There were some path issues as well. Also they don't package the SQLite interface with SOCI so you have to checkout the repo to get access to it. After getting that there are still a few snags, not to mention actually setting up SQLite as a library.

            [Updated: 10/13/2009]
            After writing this article the SOCI team has resolved some of these issues, so some of these steps are no longer necessary.

            Step 1: Setup SQLite

            Step 1.1

            Download the SQLite 3.6.18 source and library files.

            Step 1.2:

            Unarchive the SQLite archives into a directory, mine will be c:\usr\sqlite3

            Step 1.3:

            Create the sqlite3.lib file by using Visual Studio's lib command:

            LIB /DEF:sqlite3.def


            Step 2: Setup SOCI

            Step 2.1:

            Download the head of SOCI's git repository

            Step 2.2:

            Decompress the file into another directory, mine will be c:\usr\soci

            Step 2.3:

            Soci requires stdint.h but Visual Studio 2008 does not provide it, so simply download pstdint.h and rename it to stdint.h in the soci\src\core directory.

            Step 2.4:

            Open the directory soci\build and copy msvc80 to msvc90.

            Now open the msvc90\dll directory.

            Through Visual Studio 2008, open the soci_dll.sln file and allow it to convert it with the default parameters.

            Step 2.5: Build SOCI's Core and SQLite3

            SOCI's core project should build without errors, but the sqlite project will have several.

            Step 2.6: Fixing Build Errors

            Now SOCI's core project should build without errors, but the sqlite3 project will definitely fail. It will give two specific errors:

            fatal error C1083: Cannot open include file: 'sqlite3.h': No such file or directory

            and

            error C3163: '_vsnprintf': attributes inconsistent with previous declaration

            Both are relatively easy to fix.

            Step 2.6.1: Fixing SQLite3 include paths

            In Visual Studio, navigate to View->Property Manager, then in the pane that shows up, expand the sqlite3 project, then expand "Debug | Win32" then "soci_dll" then double-click on the "soci" object. Select "User Macros" on the sheet you find there.

            Find SQLITE3_INCLUDE_DIR and SQLITE_LIB_DIR and change them to the directory created earlier, "c:\usr\sqlite3"

            Step 2.6.2: Fixing _vsnprintf

            [Update 10/13/2009]
            This step is no longer needed.

            Expand the core project and look for soci-platform.h and find a line that says "HAVE_VSNPRINTF"

            This is redefining something that VS2008 provides already and confuses the hell out of the compiler. Just comment it out, or change it to look like:

            // Define if you have the vsnprintf variants.
            #if _MSC_VER < 1500
            #    define HAVE_VSNPRINTF 
            1
            #    define vsnprintf _vsnprintf
            #endif

            Step 2.7 Building SOCI's sqlite3_test project

            This project will be riddled with errors unless you have boost installed. I personally don't use it, so had to comment out large chunks of common-tests.h.  Specifically, comment out the area at the top where it includes the boost headers. Also comment out the contents of test26, test28 and test30.

            Also add this line at the bottom of soci-platform.h:

            #undef SOCI_USE_BOOST

             

            Finished

            Now you should have a working copy of SOCI 3.0.0 with SQLite3 support in Visual Studio 2008. Congratulations!


            posted on 2009-11-27 13:47 楊粼波 閱讀(1638) 評(píng)論(0)  編輯 收藏 引用


            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            婷婷综合久久中文字幕| 精品免费久久久久久久| 久久AV高潮AV无码AV| 99久久er这里只有精品18| 久久嫩草影院免费看夜色| 国内精品久久久人妻中文字幕| 久久久黄片| 久久久久综合国产欧美一区二区| 久久国产精品成人片免费| 久久久久久青草大香综合精品| 99精品国产在热久久| 久久久久亚洲av无码专区喷水 | 亚洲精品无码久久千人斩| 日批日出水久久亚洲精品tv| 久久精品a亚洲国产v高清不卡| 无码AV中文字幕久久专区| 久久精品中文字幕一区| 综合久久一区二区三区| 久久亚洲AV永久无码精品| 三级韩国一区久久二区综合 | 亚洲国产成人久久综合野外| 国产91色综合久久免费| 99久久中文字幕| 国产三级观看久久| 中文成人久久久久影院免费观看| 一本一本久久a久久精品综合麻豆| 久久久久亚洲爆乳少妇无 | 人妻精品久久久久中文字幕69| 亚洲成色WWW久久网站| 国产亚洲色婷婷久久99精品| 人妻久久久一区二区三区| 国产精品岛国久久久久| 国产精品美女久久久久网| 中文字幕久久欲求不满| 久久久精品人妻无码专区不卡| 一级做a爰片久久毛片免费陪| 久久久精品人妻一区二区三区蜜桃| 久久99精品国产自在现线小黄鸭 | 日韩亚洲国产综合久久久| 亚洲狠狠婷婷综合久久久久| 亚洲香蕉网久久综合影视|