Ошибка при сборке программы в visual studio 2017 - PullRequest
0 голосов
/ 24 августа 2018

Возникла ошибка, связанная с точкой входа, которая должна быть определена:

if (sqlite3_open("C:\ProgramData\PROISER\ISASPSUS\datastore\dsfile.db", &db) != SQLITE_OK) {
        printf("ERROR: can't open database: %s\n", sqlite3_errmsg(db));
        sqlite3_close(db);
        return found;`

Я использую Visual Studio Community 2017 с библиотеками c ++ / sqlite3.

Вот весьcode:

    #include <stdio.h>
#include <string>
using std::string;
#include <sstream>
using std::stringstream;
using namespace std;
#include "C:\\Users\\santiago.corso\\Desktop\\sqlite-amalgamation-3240000 (1)\\sqlite-amalgamation-3240000\\sqlite3.h" 
bool find_analysis(int _id)
{
    bool found = false;
    sqlite3* db;
    sqlite3_stmt* stmt;
    stringstream ss;

    // create sql statement string
    // if _id is not 0, search for id, otherwise print all IDs
    // this can also be achieved with the default sqlite3_bind* utilities
    if (_id) { ss << "select * from analysis where id = " << _id << ";"; }
    else { ss << "select * from analysis;"; }
    string sql(ss.str());

    //the resulting sql statement
    printf("sql: %s\n", sql.c_str());

    //get link to database object
    if (sqlite3_open("C:\\ProgramData\\PROISER\\ISASPSUS\\datastore\\dsfile.db", &db) != SQLITE_OK) {
        printf("ERROR: can't open database: %s\n", sqlite3_errmsg(db));
        sqlite3_close(db);
        return found;
    }

    // compile sql statement to binary
    if (sqlite3_prepare_v2(db, sql.c_str(), -1, &stmt, NULL) != SQLITE_OK) {
        printf("ERROR: while compiling sql: %s\n", sqlite3_errmsg(db));
        sqlite3_close(db);
        sqlite3_finalize(stmt);
        return found;
    }

    // execute sql statement, and while there are rows returned, print ID
    int ret_code = 0;
    while ((ret_code = sqlite3_step(stmt)) == SQLITE_ROW) {
        printf("TEST: ID = %d\n", sqlite3_column_int(stmt, 0));
        found = true;
    }
    if (ret_code != SQLITE_DONE) {
        //this error handling could be done better, but it works
        printf("ERROR: while performing sql: %s\n", sqlite3_errmsg(db));
        printf("ret_code = %d\n", ret_code);
    }

    printf("entry %s\n", found ? "found" : "not found");

    //release resources
    sqlite3_finalize(stmt);
    sqlite3_close(db);

    return found;
}

Цель этой программы - прочитать изменения в базе данных как первую часть. И вторую часть экспортировать эти изменения в файл excel (я еще не начинал с этой части).

В другой части я создаю ту же программу в другом .cpp, который сделал бы то же самое, но написал по-другому.У меня есть часть в этом коде, задачей которой является поиск конца файла и начало чтения оттуда:

    void recordarposicion(){
int feof;
if (fseek(dsfile, 0L, SEEK_END)==feof)
printf("%i = fread(dsfile)" );
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...