加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

win7x32使用vscode调试c语言调试sqlite3范例配置

发布时间:2020-12-15 04:50:13 所属栏目:百科 来源:网络整理
导读:程序范例: #include #include #include "sqlite3.h" int main(int argc,char* argv[]) { sqlite3 *db; char *zErrMsg = 0; int rc; rc = sqlite3_open("test.db",db); if( rc ){ fprintf(stderr,"Can't open database: %sn",sqlite3_errmsg(db)); exit(0);

程序范例:

#include

#include

#include "sqlite3.h"

int main(int argc,char* argv[])

{

sqlite3 *db;

char *zErrMsg = 0;

int rc;

rc = sqlite3_open("test.db",&db);

if( rc ){

fprintf(stderr,"Can't open database: %sn",sqlite3_errmsg(db));

exit(0);

}else{

fprintf(stderr,"Opened database successfullyn");

}

sqlite3_close(db);

getchar();

return(0);

}

c_cpp.json配置

{

"configurations": [

{

"name": "Win32",

"includePath": [

"${workspaceFolder}/**",

"c:/mingw",

"C:mingwbin",

"C:mingwinclude",

"C:mingwlib",

"c:/sqlite3"

],

"defines": [

"_DEBUG",

"UNICODE",

"_UNICODE"

],

"intelliSenseMode": "msvc-x64"

}

],

"version": 4

}

launch.json配置

{

// 使用 IntelliSense 了解相关属性。

// 悬停以查看现有属性的描述。

// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387

"version": "0.2.0",

"configurations": [

{

"name": "(gdb) Launch",

"type": "cppdbg",

"request": "launch",

"program": "${workspaceFolder}/hello.exe",

"args": [],

"stopAtEntry": false,

"cwd": "${workspaceFolder}",

"environment": [],

"externalConsole": true,

"MIMode": "gdb",

"miDebuggerPath": "C:/mingw/bin/gdb.exe",

"preLaunchTask":"build",

"setupCommands": [

{

"description": "Enable pretty-printing for gdb",

"text": "-enable-pretty-printing",

"ignoreFailures": true

}

]

}

]

}

tasks.json配置

{

// See https://go.microsoft.com/fwlink/?LinkId=733558

// for the documentation about the tasks.json format

"version": "2.0.0",

"tasks": [

{

"label": "build",

"type": "shell",

"command": "C:mingwbingcc.exe",

"args": [

"-I","c:/sqlite3/","-L","-lsqlite3","-g","hello.c","-o","hello"

],

"group": {

"kind":"build",

"isDefault": true

}

}

]

}

路径用或者/,否则报错。


系统path必须添加sqlite3的路径。


gcc参数放在args数组里面,不用每次手动输入。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读