Visual Studio Compile Issue
(1) By anonymous on 2020-12-09 16:04:56 [source]
I have a project in which I have embedded the SQLite Amalgamation library. Everything worked great and I have produced a number of releases of my project. A few days ago I opened my project to make a minor change and went to compile and I get 52 errors. To my knowledge nothing had changed with Windows, Visual Studio or the Project. I went back to previous versions which are completely separate copies of the project and I see the same 52 errors. When following the errors most seemed related to DEBUG sections so I defined SQLITE_DEBUG and the project compiles with no problem. I cannot find any post here or elsewhere which mention such a problem and nothing I have tried such as Cleaning the solution, tweaking Properties, etc. make the least bit of difference. Issue would seem to indicate some global setting has changed but I have no idea what it might be. Suggestions? Jim
(2) By Warren Young (wyoung) on 2020-12-09 16:07:56 in reply to 1 [link] [source]
Post the errors.
(3) By Gerry Snyder (GSnyder) on 2020-12-09 16:26:50 in reply to 1 [link] [source]
I had a vaguely similar situation when compiling the Tcl interface a few days ago.
My problem was that I was doing the compile in a VS PowerShell instead of a VS Command Prompt.
Probably not your situation, but I thought it worth mentioning.
Gerry Snyder
(4) By anonymous on 2020-12-09 16:27:11 in reply to 2 [link] [source]
Thanks for the reply. Severity Code Description Project File Line Suppression State Error C2065 'mutexIsInit': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 26019 Error C2039 'nRef': is not a member of 'sqlite3_mutex' Sql_Project c:\Sqlite\sqlite3.c 27256 Error C2039 'owner': is not a member of 'sqlite3_mutex' Sql_Project c:\Sqlite\sqlite3.c 27256 Error C2065 'tid': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 27307 Error C2065 'eType': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 46931 Error C2065 'eType': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 46932 Error C2065 'eType': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 46933 Error C2065 'eType': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 46934 Error C2065 'eType': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 46941 Error C2065 'isOpenJournal': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 46958 Error C2065 'eType': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 46972 Error C2065 'nPage': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 50667 Error C2065 'pCache': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 51030 Error C2223 left of '->bPurgeable' must point to struct/union Sql_Project c:\Sqlite\sqlite3.c 51030 Error C2065 'pCache': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 51031 Error C2223 left of '->bPurgeable' must point to struct/union Sql_Project c:\Sqlite\sqlite3.c 51031 Error C2223 left of '->nMin' must point to struct/union Sql_Project c:\Sqlite\sqlite3.c 51031 Error C2065 'pCache': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 51032 Error C2223 left of '->bPurgeable' must point to struct/union Sql_Project c:\Sqlite\sqlite3.c 51032 Error C2223 left of '->nMin' must point to struct/union Sql_Project c:\Sqlite\sqlite3.c 51032 Error C2065 'pCache': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 51033 Error C2223 left of '->nMin' must point to struct/union Sql_Project c:\Sqlite\sqlite3.c 51033 Error C2223 left of '->bPurgeable' must point to struct/union Sql_Project c:\Sqlite\sqlite3.c 51033 Error C2065 'pCache': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 51034 Error C2223 left of '->nHash' must point to struct/union Sql_Project c:\Sqlite\sqlite3.c 51034 Error C2065 'pPager': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 57622 Error C2223 left of '->pPCache' must point to struct/union Sql_Project c:\Sqlite\sqlite3.c 57622 Error C2198 'sqlite3PcacheRefCount': too few arguments for call Sql_Project c:\Sqlite\sqlite3.c 57622 Error C2039 'lockError': is not a member of 'Wal' Sql_Project c:\Sqlite\sqlite3.c 62665 Error C2039 'lockError': is not a member of 'Wal' Sql_Project c:\Sqlite\sqlite3.c 63530 Error C2065 'debuginfo': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 66068 Error C2224 left of '.nSize' must have struct/union type Sql_Project c:\Sqlite\sqlite3.c 66068 Error C2065 'debuginfo': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 66089 Error C2224 left of '.nSize' must have struct/union type Sql_Project c:\Sqlite\sqlite3.c 66089 Error C2065 'nRef': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 68694 Error C2065 'nCellAtStart': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 72496 Error C2065 'balance_deeper_called': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 73143 Error C2065 'balance_quick_called': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 73186 Error C2065 'nRef': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 74903 Error C2065 'nRef': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 75017 Error C2065 'rc2': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 75860 Error C2039 'seekOp': is not a member of 'VdbeCursor' Sql_Project c:\Sqlite\sqlite3.c 91314 Error C2039 'seekOp': is not a member of 'VdbeCursor' Sql_Project c:\Sqlite\sqlite3.c 91319 Error C2065 'nExtraDelete': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 93791 Error C2065 'iSz': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 95931 Error C2065 'pOld': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 111559 Error C2065 'nLookaside': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 111580 Error C2039 'bInverse': is not a member of 'CountCtx' Sql_Project c:\Sqlite\sqlite3.c 119169 Error C2065 'rcp': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 128972 Error C2065 'yyRuleName': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 158285 Error C2109 subscript requires array or pointer type Sql_Project c:\Sqlite\sqlite3.c 158285 Error C2065 'startedWithOom': undeclared identifier Sql_Project c:\Sqlite\sqlite3.c 161209
(5) By anonymous on 2020-12-09 16:28:19 in reply to 3 [link] [source]
Appreciate the reply. I am compiling using the VS Build option in the IDE.
Jim
(6) By doug (doug9forester) on 2020-12-09 16:42:13 in reply to 1 [link] [source]
This may not be your problem: I recently added a folder to the system PATH. The folder has tools in it that I have downloaded. Turns out that the folder tools conflicted with Qt's toolset so I had to remove the folder from Qt's path to get things to work.
(7) By Larry Brasfield (LarryBrasfield) on 2020-12-09 18:09:33 in reply to 4 [link] [source]
You are going to have to figure out what is going wrong with your build. The odds are astronomically against somebody here having seen or posted the same issue.
The Visual Studio IDE build system ultimately just runs the command line compiler, linker, etc. to effect its builds. You can consult the logs to see how those tools were invoked, including the compilation preprocessing flags. You may need to run the compile with those same flags, except with -E or -P to capture preprocessed output. Then you can "compile" that with a -Zs flag (for syntax checking only) to determine where in that largish "source" the first several of your errors arise. Then you need to find out why by studying where the complaint-inducing references to undeclared objects are made and where those objects were supposed to be declared. You may do some string searches among .c and .h files for relevant identifiers.
The -E or -P output shows where the #include files were found. You need to ensure that the SQLite libarary files are coming from a single release rather than some strange combination.
You will do well to turn off precompiled headers. That feature speeds compilation wonderfully, but it can get really messed up sometimes.
While I do not like to encourage big error dumps to this forum, or people throwing up their hands and hoping somebody else can sort out ordinarily messed-up build problems, I will say that your errors strongly suggest that the problem is very fundamental. In particular, to see an error, "'Blah': undeclared ...", when compiling the very source in which 'Blah' is declared prior to use, indicates to me that the examination of preprocessed output is due. The objects complained of that I checked are declared and used within preprocessor conditionals. Those declarations and usages appear to have coordinated conditions, suggesting that some cross-release source mixing is occurring.
(8) By Warren Young (wyoung) on 2020-12-09 18:24:00 in reply to 4 [link] [source]
First, you're not on the current version, based on line numbers. If you're going to post a question without specifying the version number you're using, you should update to the current version and check that it also occurs with that version, that being the default assumption. Otherwise, specify the exact version you are using. (And you should also justify why you're using an old version.)
Second, the first two of those errors I checked are assert()
calls. I assume the others are as well, which means you're compiling with assertions but without debugging. I'd guess that's an unsupported configuration. Either:
Define
SQLITE_DEBUG
in Debug builds, which also define_DEBUG
, thus enabling assertions; orUndefine
_DEBUG
forsqlite3.c
for Debug builds.
(9) By anonymous on 2020-12-09 19:38:21 in reply to 8 [link] [source]
Apologies...I should have mentioned version. This post was from 3.34, which I believe is the latest. I had added #define SQLITE_DEBUG 1 and had it commented out so things may have shifted one or two lines. As mentioned, the same thing happens if I open old copies of this project with older versions. Exact same errors. By defining SQLITE_DEBUG it compiles. The puzzle for me is why it worked one day but when I opened it up a few days later this starts happening without any recallable changes to VS settings, including all the old projects. Assuming I understand, I am trying to do a Release build and not a Debug. I did try undefining _DEBUG but didn't make a difference, assuming I did that right. Don't want to waste more of anyone's time. Just stuck as the issue makes no sense. Really need to get a fix out to users but no way forward that I can find. What are the downsides of posting a version where SQLITE_DEBUG is enabled? Thanks again all. Jim
(10) By Warren Young (wyoung) on 2020-12-09 21:54:59 in reply to 9 [link] [source]
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.
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?
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.
(11) By anonymous on 2020-12-10 03:30:51 in reply to 10 [link] [source]
Again, Thank you for your time and advice. I am still figuring out VS so that doesn't help. I believe I have done what you suggested. Here is the command line generated by VS. I couldn't find any reference to "_DEBUG" but added it with "SQLITE_DEBUG" for undefining in properties. I even created a brand new project and still encountered the same problem. Took a completely different project that works and replaced the file contents and still the same issue. Oddly enough I have another project that has started failing with weird errors that worked fine. Nothing to do with SQLite but just odd. Not sure what else to try. I never messed with any of this stuff because it worked fine as it was when I created the project and all the months since. Wish I knew why it popped up now??? Happy for any more suggestions but feel like I am taking up too much of your time. I guess I will just have to post DEBUG versions. Maybe it will start working again, correctly, like it stopped. Thanks again. Jim /ifcOutput "Release\" /GS /analyze- /W3 /Zc:wchar_t /Zi /Gm- /Ox /Fd"Release\vc142.pdb" /Zc:inline /fp:precise /U"_DEBUG" /U"SQLITE_DEBUG" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SQLITE_ENABLE_COLUMN_METADATA" /D "SQLITE_ENABLE_JSON1" /D "_WINDLL" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /MT /FC /Fa"Release\" /EHsc /nologo /Fo"Release\" /Fp"Release\wbsql44i.pch" /diagnostics:column