SQLite Forum

Visual Studio Compile Issue
Login
> I had added #define SQLITE_DEBUG 1 and had it commented out so things may have shifted one or two lines.

You should make such changes in your project settings, not in the file itself. That not only allows you to replace the file without changing the settings, it separates vendor-supplied code from local changes. It also avoids confusions like mine, where I assumed that if the line numbers were different, you must be on another version.

It's exceptionally rare to change `#define` values by modifying a `*.c` file. Sometimes you see someone creating a `*.h` file to contain such changes, but since there is no such user-provided file that `sqlite3.c` includes for the purpose, there's no particularly good reason to do it that way.

No, set defines with `/D` and undefines with `/U` [in the project settings][1].

> The puzzle for me is why it worked one day but when I opened it up a few days later

I'm going to guess you're developing without version control? If so, may I suggest using [Fossil][2]?

Meanwhile, your project files are human-readable, for sufficiently bright values of "human". :) Skimming them with this hindsight might be enlightening.

> I did try undefining _DEBUG

Where, exactly?

If you do it in the wrong place, it will just get redefined later, and that'll undo your change. There is no "undefine and *keep* undefined" option in VC++.

> I am trying to do a Release build and not a Debug.

That's as may be. The only way I see to get the symptom you describe is for `_DEBUG` to be defined while `SQLITE_DEBUG` is undefined, so that the `assert()` macro contents are compiled into the program while the definitions needed by them are not compiled in.

My prior answer assumes that what you want is for Debug builds to have both defined and for Release builds to have neither defined, because...

> What are the downsides of posting a version where SQLITE_DEBUG is enabled?

It runs slower, because of all of the checks. That's one big reason why the concept of Debug vs Release exists.

[1]: https://docs.microsoft.com/en-us/cpp/build/working-with-project-properties?view=msvc-160#c-compiler-and-linker-options
[2]: https://www.fossil-scm.org/