c++ - 运行 C++ 应用程序后出现 SQLite 控制台

标签 c++ sqlite

我的问题是,当我运行主 .cpp 文件时,SQLite 控制台出现并等待命令,而不是执行代码中的操作并产生一些输出。问题是什么? 好吧,代码只是一个测试,以确保一切正常:

#include "sqlite3.h"
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
sqlite3 *database;
sqlite3_open("Database.sqlite", &database);
sqlite3_stmt *statement;

if (sqlite3_prepare_v2(database, "CREATE TABLE a (b INTEGER, c INTEGER);", -1, &statement, 0) == SQLITE_OK) {
    int cols = sqlite3_column_count(statement);
    cout << cols;

    int result = sqlite3_step(statement);
}
return 0;
}

最佳答案

不要将 sqlite 的 shell.c 包含到您的项目中。

关于c++ - 运行 C++ 应用程序后出现 SQLite 控制台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13308633/

相关文章:

c++ - 什么时候允许编译器优化复制构造函数

sqlite - 对整个 SQLite 表进行排序

android - 类型干扰失败。 Kotlin 和 Anko 中的预期类型不匹配 : required String found pair<String, String>

C++ - 将 .at() 方法与字符串一起使用时出现问题

c# - 在 C# 中使用 C++ 代码

c++ - 在源代码中嵌入较长文本的技巧,如 Perl 等语言?

ios - 与 ios swift 本地数据库和服务器同步数据

java - 如何访问 JPA 中的鉴别器列

c++ - 使用 SQlite 批量插入

c++ - 使用 3 个堆栈实现排序。 (段错误 - 核心转储)