SQLite Forum

How ddo I specify options with MSVC
Login

How ddo I specify options with MSVC

(1) By anonymous on 2021-07-07 08:45:39 [link]

Hello,

Building from source with CI.exe was quite easy as follows.

C:/temp/sqlite>cl shell.c sqlite3.c -Fesqlite3.exe
Microsoft(R) C/C++ Optimizing Compiler Version 19.29.30037 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

shell.c
shell.c(19802): warning C4819: some warning message
shell.c(19815): warning C4819: some warning message
sqlite3.c
Generating code..
Microsoft (R) Incremental Linker Version 14.29.30037.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:sqlite3.exe
shell.obj
sqlite3.obj


And It seems to  run Okay.

C:/temp/sqlite>sqlite3.exe
SQLite version 3.36.0 2021-06-18 18:36:39
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite>

However, what I want to do is compile sqlite3.exe with options like
SQLITE_MAX_COLUMN=16384

How do I do this with CL.exe? The examples I find on the internet are only ones with gcc.

I hope someone can help. Thank you.

(2.1) By ddevienne on 2021-07-07 09:29:35 edited from 2.0 in reply to 1 [link]

You just add `/D "SQLITE_MAX_COLUMN=16384"` on your `CL` cli.

You may also want to add [`/O2`](1) to make it fast too.

But of course, having 16K columns is suspicious from a relational design POV :)

[1]: https://docs.microsoft.com/en-us/cpp/build/reference/o1-o2-minimize-size-maximize-speed?view=msvc-160

(3) By mzm2021 on 2021-07-07 09:26:50 in reply to 1 [link]

As all C compilers, you can pass defines to CL.exe on the command line: [/D (Preprocessor Definitions)](https://docs.microsoft.com/en-us/cpp/build/reference/d-preprocessor-definitions?view=msvc-160).

```
cl /D SQLITE_MAX_COLUMN=16384 shell.c sqlite3.c -Fesqlite3.exe
```

(4) By Keith Medcalf (kmedcalf) on 2021-07-07 17:13:24 in reply to 1

cl -?

may be of assistance.

(5) By anonymous on 2021-07-08 03:47:12 in reply to 4 [link]

You are all great!

cl shell.c sqlite3.c -Fesqlite3ex.exe /D "SQLITE_MAX_COLUMN=16384" /O2

did compile and I could create a table with 8192 fields.

Thank you very much.