Gradian
Gradian

Reputation: 11

Using Sqlite3 with visual C++ 2003

I am trying to use sqlite3 on a program written by C++ 2003. I have downloaded sqlite-amalgamation-3360000.zip from download page and add sqlite3.h to header files, shell.c & sqlite3.c to resources file. then I write a simple code in test.cpp to test the connection:

#include "sqlite3.h"
#include <iostream>

int main()
{

    sqlite3 *db;

    sqlite3_open("test.sqlite", &db);


    return 0;
}

however when I compiled it always show error: sqlite3.c(27474): error C2692: '_ReadWriteBarrier' : fully prototyped functions required in C compiler with the '/clr' option

I dont know what I did wrong. Please can someone help?

Upvotes: 0

Views: 217

Answers (1)

Botje
Botje

Reputation: 30807

_ReadWriteBarrier is a compiler intrinsic function: the compiler is programmed to handle it specially. This is declared in the intrin.h header file.

From sqlite3.c:

/*
** Make sure that the compiler intrinsics we desire are enabled when
** compiling with an appropriate version of MSVC unless prevented by
** the SQLITE_DISABLE_INTRINSIC define.
*/
#if !defined(SQLITE_DISABLE_INTRINSIC)
#  if defined(_MSC_VER) && _MSC_VER>=1400
#    if !defined(_WIN32_WCE)
#      include <intrin.h>
#      pragma intrinsic(_byteswap_ushort)
#      pragma intrinsic(_byteswap_ulong)
#      pragma intrinsic(_byteswap_uint64)
#      pragma intrinsic(_ReadWriteBarrier)
#    else
#      include <cmnintrin.h>
#    endif
#  endif
#endif

Since you are compiling on an ancient version of MSVC, I suggest disabling this by defining the SQLITE_DISABLE_INTRINSIC preprocessor symbol.

Upvotes: 2

Related Questions