vs2017 vs2019配置sqlite3连接引擎(驱动)指南(二)vs2019续集

在写完上一篇博客后,一觉醒来,又又又又不行了,介绍一个终极大招,如果你的fuck vs又提示无法打开sqlite3.h的问题

环境win10  vs2019 debug x86

实在没心情写文字了,直接上图

 

你的目录下,把这些sqlite3文件全扔进去,看样子必须这么做,否则即使你添加了现有项,傻逼vs仍旧告诉你打不开sqlite3.h

 

 项目中添加,sqlite3.lib  sqlite3.h,昨天还不认sqlite3.h呢,今儿可能吃饱了,又认了

 

 

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sqlite3.h"
#pragma comment(lib,"sqlite3.lib")  

static int callback(void* NotUsed, int argc, char** argv, char** azColName) {
    int i;
    for (i = 0; i < argc; i++) {
        printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
    }
    printf("\n");
    return 0;
}




int main()
{
    sqlite3* db;
    char* zErrMsg = 0;
    int  rc;
    char* sql;
    
    rc = sqlite3_open("test.db", &db);
    if (rc) {
        fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
        exit(0);
    }
    else {
        fprintf(stdout, "Opened database successfully\n");
    }

    /* Create SQL statement */
    sql = "CREATE TABLE COMPANY("  \
        "ID INT PRIMARY KEY     NOT NULL," \
        "NAME           TEXT    NOT NULL," \
        "AGE            INT     NOT NULL," \
        "ADDRESS        CHAR(50)," \
        "SALARY         REAL );";

    /* Execute SQL statement */
    rc = sqlite3_exec(db, sql, callback, 0, &zErrMsg);
    if (rc != SQLITE_OK) {
        fprintf(stderr, "SQL error: %s\n", zErrMsg);
        sqlite3_free(zErrMsg);
    }
    else {
        fprintf(stdout, "Table created successfully\n");
    }
    sqlite3_close(db);
    return 0;
}

 

 留一照片儿,明儿又不知什么操行了

 

 

 

 不说了,我想操vs 和sqlite3 两边项目组的大爷

posted @ 2020-02-28 14:39  saintdingtheGreat  阅读(1050)  评论(0编辑  收藏  举报