sqlite3.c is C file. C does not support namespaces. Even though another project files are .cpp, sqlite3.c is still compiled as C language source. Therefore, no ability to use "using namespace" in sqlite3.c. Also, "using namespace" does not actually put functions in the source in namespace. It just helps it find another functions without specifying namespace name.
Sent with [ProtonMail](https://protonmail.com) Secure Email. -------- Original Message -------- Subject: Re: [sqlite] "struct Mem" conflicts with namespaces/classes having the same name Local Time: April 9, 2017 10:23 PM UTC Time: April 9, 2017 7:23 PM From: d3c...@gmail.com To: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> On Sun, Apr 9, 2017 at 12:20 PM, Richard Damon <rich...@damon-family.org> wrote: > On 4/9/17 1:49 PM, Olivier Mascia wrote: > >> Le 9 avr. 2017 à 18:49, dip <x...@protonmail.com> a écrit : >>> >>> I downloaded latest SQLite Amalgamation (v 3.18.0) to embed it in my >>> project. >>> After that I got a lot of errors while compiling (compiler is Microsoft >>> Visual Studio 2017). >>> Errors were caused by the following line in sqlite3.h: >>> >>> typedef struct Mem sqlite3_value; >>> >>> The reason is that I have the namespace with the same name. >>> So I have a suggestion to rename "struct Mem" to something else (add >>> prefix to it) because "Mem" is a very common name like "input" or "data" or >>> "buffer" and there may be classes or namespaces having the same name. >>> >> The way to overcome this completely in large programmings using many >> libraries is to include sqlite3.h within a namespace. Not something that >> SQLite code must do itself: that's best handled at the user project level. >> >> The problem with this is that if the header file is put in a namespace in > the user code, then the source file that defines these functions needs to > also be changed to put the files in that same namespace, or the things > being defined won't be found. > > think that's what 'use namespace' is for > -- > Richard Damon > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users