Hi, For the record, I have just managed to build SOCI 3.2.3 with VS2015 (CL.EXE version19.00.24215.1) without any problems or modifications required.
git clone https://github.com/SOCI/soci.git git co release/3.2 mkdir _build cd _build cmake .. then load SOCI.sln with VS2015 and build. I'm leaving the release/3.2 branch as it is. BTW, master builds w/o problems too. Regards, Mateusz On 28 November 2016 at 20:21, john <j...@dgi.com> wrote: > Erasmo, > > I modified soci-platform.h by enclosing _snprintf as follows: > > #if _MSC_VER < 1800 > #define snprintf _snprintf > #endif > > Then the remaining library built. I did some testing and SOCI is now > working for me compiled with VC 14. > > Thank you very much for your help with this! > > john > > PS Sorry for the delay getting back to you. I was on a week long > Thanksgiving holiday. > > > On 11/19/2016 7:24 AM, Erasmo Aguilera wrote: >> John, >> >> Look carefully, the ODBC backend just issues a warning that seems to be >> unimportant. >> >> The build fails because there are two included files that redefine the >> 'snprintf' symbol. The first definition is in >> "D:\devsrc\soci-3.2.3\core\soci-platform.h" and the second one (which >> produces the error) is in "C:\Program Files (x86)\Windows >> Kits\10\include\10.0.10150.0\ucrt\stdio.h" (a Standard Library file). >> >> To fix the error, comment the line 27 of >> "D:\devsrc\soci-3.2.3\core\soci-platform.h": >> >> // #define snprintf _snprintf >> >> , so that SOCI ignores its own definition and uses that of the Standard >> Library instead. >> >> Hope it helps. >> >> >> Erasmo. >> >> >> -----Original Message----- >> From: john [mailto:j...@dgi.com] >> Sent: viernes 18 de noviembre de 2016 6:52 p. m. >> To: soci-users@lists.sourceforge.net >> Subject: Re: [soci-users] Does SOCI support VisualStudio 2015/VC 14? >> >> Erasmo, >> >> Oh, I see. Sorry that I missed that. >> >> lib/soci_core_3_2.lib built successfully. >> >> However the odbc backend failed: >> >> D:\devsrc\soci-3.2.3\backends\odbc\session.cpp(63): warning C4996: >> 'sscanf': This function or variable may be unsafe. Consider using sscanf_s >> instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. >> See online help for details. >> C:\Program Files (x86)\Windows >> Kits\10\include\10.0.10150.0\ucrt\stdio.h(2254): note: see declaration of >> 'sscanf' >> [ 59%] Building CXX object >> backends/odbc/CMakeFiles/soci_odbc.dir/standard-into-type.cpp.obj >> standard-into-type.cpp >> C:\Program Files (x86)\Windows >> Kits\10\include\10.0.10150.0\ucrt\stdio.h(1925): warning C4005: >> 'snprintf': macro redefinition >> D:\devsrc\soci-3.2.3\core\soci-platform.h(27): note: see previous definition >> of 'snprintf' >> C:\Program Files (x86)\Windows >> Kits\10\include\10.0.10150.0\ucrt\stdio.h(1927): fatal error C1189: >> #error: Macro definition of snprintf conflicts with Standard Library >> function declaration NMAKE : fatal error U1077: >> 'C:\PROGRA~2\MICROS~4.0\VC\bin\amd64\cl.exe' >> : return code '0x2' >> Stop. >> NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio >> 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2' >> Stop. >> NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio >> 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2' >> Stop. >> >> Thanks a lot for your help, >> john >> >> On 11/18/2016 2:51 PM, Erasmo Aguilera wrote: >>> John, >>> >>> A SOCI.sln is created by default because you are not specifying any build >>> system with the -G option for cmake. I don't know if SOCI has issues with >>> Visual Studio 2015, it shouldn't. But that is why I suggested you to try >>> building SOCI from the command line with NMake using the "-G "NMake >>> Makefiles" option (without quotes). Follow the steps I gave you and tell me >>> how it goes. >>> >>> Hope it helps. >>> >>> Erasmo. >>> >>> -----Original Message----- >>> From: john [mailto:j...@dgi.com] >>> Sent: viernes 18 de noviembre de 2016 10:55 a. m. >>> To: soci-users@lists.sourceforge.net >>> Subject: Re: [soci-users] Does SOCI support VisualStudio 2015/VC 14? >>> >>> Thank you very much Erasmo. The thing is that when I set my build >>> environment to use VC 11 and then run cmake a SOCI.sln is created which I >>> can then use to build SOCI. >>> >>> However when I set my build environment to use VC 14 and then run cmake a >>> SOCI.sln is created which is useless. Loading that SOCI.sln gives the >>> attached errors. So does than mean that with VC 14 I have to build SOCI >>> outside of devenv? >>> >>> john >>> >>> >>> On 11/17/2016 6:38 PM, Erasmo Aguilera wrote: >>>> Hello John, >>>> >>>> It seems that you are building SOCI on an x64 machine, but you are using >>>> the x86 compiler of Visual Studio. Maybe you are using a x86 configuration >>>> for the Visual Studio project. To fix it, either change the Visual Studio >>>> configuration to a x64 one or use NMake for the build instead (just as I >>>> do it). >>>> >>>> If you wanna go with NMake, try the following: >>>> >>>> - Open a new command prompt. >>>> - Run "C:\Program Files (x86)\Microsoft Visual Studio >>>> 14.0\VC\bin\amd64\vcvars64.bat". This will set the required VC variables >>>> for using the x64 compiler tools. >>>> - Try building SOCI again with the same command, but also including >>>> these options: -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=C:\SOCI >>>> - Run "nmake" >>>> - Run "nmake install" >>>> - If everything goes well, you'll find the installed SOCI files in C:\SOCI. >>>> >>>> Hope it helps. >>>> >>>> PS: Remember, the benefit of using a free tool is at the price of >>>> support. If you make a question to a user's list and get an answer, >>>> consider yourself lucky. :) >>>> >>>> >>>> Erasmo. >>>> >>>> >>>> -----Original Message----- >>>> From: john [mailto:j...@dgi.com] >>>> Sent: jueves 17 de noviembre de 2016 7:11 p. m. >>>> To: soci-users@lists.sourceforge.net >>>> Subject: [soci-users] Does SOCI support VisualStudio 2015/VC 14? >>>> >>>> I posted this question on 2016-09-16 but have not seen a response. Does >>>> anybody know whether or not SOCI supports VisualStudio 2015? Here's my >>>> original question: >>>> >>>> Does soci-3.2.3 support VC 14? The following command appeared to be >>>> successful: >>>> >>>> cmake -DSOCI_STATIC=ON -DWITH_DB2=OFF -DWITH_FIREBIRD=OFF -DWITH_MYSQL=OFF >>>> -DWITH_ORACLE=OFF -DWITH_POSTGRESQL=OFF -DWITH_SQLITE3=OFF >>>> -DSOCI_EMPTY=OFF -DWITH_BOOST=ON -DWITH_ODBC=ON -DSOCI_ODBC=ON .. >>>> >>>> -- Building for: Visual Studio 14 2015 >>>> -- The C compiler identification is MSVC 19.0.23026.0 >>>> -- The CXX compiler identification is MSVC 19.0.23026.0 >>>> -- Check for working C compiler using: Visual Studio 14 2015 >>>> -- Check for working C compiler using: Visual Studio 14 2015 -- works >>>> -- Detecting C compiler ABI info >>>> -- Detecting C compiler ABI info - done >>>> -- Check for working CXX compiler using: Visual Studio 14 2015 >>>> -- Check for working CXX compiler using: Visual Studio 14 2015 -- >>>> works >>>> -- Detecting CXX compiler ABI info >>>> -- Detecting CXX compiler ABI info - done >>>> -- Detecting CXX compile features >>>> -- Detecting CXX compile features - done >>>> -- Configuring SOCI: >>>> -- SOCI_VERSION = 3.2.3 >>>> -- SOCI_ABI_VERSION = 3_2 >>>> >>>> ... >>>> >>>> However all builds fail with messages like: >>>> >>>> x64\Debug\backend-loader.obj : fatal error LNK1112: module machine type >>>> 'x64' conflicts with target machine type 'X86' >>>> >>>> I see 14 in the compiler and linker lines: >>>> >>>> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c >>>> /Zi >>>> /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D >>>> "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise >>>> /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_7a48a.dir\Debug\\" >>>> /Fd"cmTC_7a48a.dir\Debug\vc140.pdb" /Gd /TC /analyze- /errorReport:queue >>>> "C:\Program Files (x86)\CMake\share\cmake-3.4\Modules\CMakeCCompilerABI.c" >>>> >>>> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\link.exe >>>> /ERRORREPORT:QUEUE >>>> /OUT:"D:\devsrc\soci-3.2.3\build_64\CMakeFiles\CMakeTmp\Debug\cmTC_7a48a.exe" >>>> >>>> /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib >>>> shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib >>>> /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" >>>> /manifest:embed /Debug >>>> /PDB:"D:/devsrc/soci-3.2.3/build_64/CMakeFiles/CMakeTmp/Debug/cmTC_7a48a.pdb" >>>> >>>> /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT >>>> /IMPLIB:"D:/devsrc/soci-3.2.3/build_64/CMakeFiles/CMakeTmp/Debug/cmTC_7a48a.lib" >>>> >>>> /MACHINE:X86 /SAFESEH /machine:X86 /debug >>>> cmTC_7a48a.dir\Debug\CMakeCCompilerABI.obj >>>> >>>> I see /MACHINE:X86 in the link line above. Do I need to edit some SOCI >>>> config files or does SOCI already support VC 14? >>>> >>>> Thanks, >>>> john >>>> >>>> >>>> --------------------------------------------------------------------- >>>> - >>>> -------- _______________________________________________ >>>> soci-users mailing list >>>> soci-users@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/soci-users >>>> >>>> --------------------------------------------------------------------- >>>> - >>>> -------- _______________________________________________ >>>> soci-users mailing list >>>> soci-users@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/soci-users >>>> >>>> >>> ---------------------------------------------------------------------- >>> -------- _______________________________________________ >>> soci-users mailing list >>> soci-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/soci-users >>> >>> >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> soci-users mailing list >> soci-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/soci-users >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> soci-users mailing list >> soci-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/soci-users >> >> > > > ------------------------------------------------------------------------------ > _______________________________________________ > soci-users mailing list > soci-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/soci-users -- Mateusz Loskot, http://mateusz.loskot.net ------------------------------------------------------------------------------ _______________________________________________ soci-users mailing list soci-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/soci-users