How to compile the lastest Boost(Version 1.63.0)? - c++

Thanks for #Praetorian 'help, problem Was solved.
That's what I do:
download the beta version of boost (present beta version: 1.64)
Do what's told here: How to use Boost in Visual Studio 2010
To install Boost, I have done what am I told(http://www.boost.org/doc/libs/1_63_0/more/getting_started/ and How to use Boost in Visual Studio 2010.)
But "argument error" still returned after running b2
What's the mistake do I make?
//What I do
$ b2 --toolset=msvc-14.0 --build-type=complete architecture=x86 address-model=64 stage
//Return
*** argument error
rule maybe-rewrite-setup ( toolset : setup-script : setup-options : version : rewrite-setup ? )
called with: ( msvc : : : default : )
missing argument setup-script
//Using
Visual Studio 2017 community
x86 Native Tools Command Prompt for VS 2017

Related

Specifying toolset version when building boost 1.55 with MSVC 2015

I download boost 1.55, extract it, and run the following:
> bootstrap.bat
cl : Command line warning D9035 : option 'GZ' has been deprecated and will be removed in a future release
cl : Command line warning D9036 : use 'RTC1' instead of 'GZ'
cl : Command line warning D9002 : ignoring unknown option '/MLd'
Bootstrapping is done. To build, run:
...
> b2 --build-type=complete --build-dir=build --toolset=msvc-14.0 stage
However, I get the following error:
error: msvc initialization: parameter 'version' inconsistent
error: no value was specified in earlier initialization
error: an explicit value is specified now
Following the same steps with MSVC 2012, I didn't get that error.
If I do --toolset=msvc instead, then it works. However, the generated files have -vc instead of -vc140, which is what I'd like.
How do I specify the toolset explicitly? Where was it "specified in earlier initialization"?
(The reason I want to do this is I am getting a weird linker error later - saying it's looking for some -vc120 boost library... and I have no idea why. I'm trying to eliminate all the possibilities.)
The previously specified version is in project-config.jam:
using msvc ;
Change it to:
using msvc : 14.0 ;

Compiling MySQL Connector with Visual Studio 2015 Win64

After creating a solution with cmake, I am being put face to face with 1400 errors in Visual Studio during build.
The main problem is, it seems no one compiles the connector, and just uses the precompiled library for their projects, more so on Windows.
Here are some of errors, it seems timespec is being redefined one more time, first of all in ,and then a second time in my_global.h, errors and definitons below.
So the question is, how the hell do I fix 1400 errors?
Or at least, some advice how to get rid of redefinition would be GREAT!
time.h
#ifndef _CRT_NO_TIME_T
struct timespec
{
time_t tv_sec; // Seconds - >= 0
long tv_nsec; // Nanoseconds - [0, 999999999]
};
#endif
my_global.h
struct timespec {
union ft64 tv;
/* The max timeout value in millisecond for native_cond_timedwait */
long max_timeout_msec;
};
Error C2011 'timespec': 'struct' type redefinition (compiling source file C:\Users\DDubinin\Downloads\mysql-connector-c-6.1.6-src\mysys\my_mess.c) mysys c:\users\ddubinin\downloads\mysql-connector-c-6.1.6-src\include\my_global.h 660
Error C2039 'tv': is not a member of 'timespec' (compiling source file C:\Users\DDubinin\Downloads\mysql-connector-c-6.1.6-src\mysys\my_malloc.c) mysys c:\users\ddubinin\downloads\mysql-connector-c-6.1.6-src\include\my_global.h 681
Error C2227 left of '->tv' must point to class/struct/union/generic type (compiling source file C:\Users\DDubinin\Downloads\mysql-connector-c-6.1.6-src\libmysql\authentication_win\handshake.cc) auth_win_client c:\users\ddubinin\downloads\mysql-connector-c-6.1.6-src\include\my_global.h 681
Error C2227 left of '->max_timeout_msec' must point to class/struct/union/generic type (compiling source file C:\Users\DDubinin\Downloads\mysql-connector-c-6.1.6-src\libmysql\authentication_win\plugin_client.cc) auth_win_client c:\users\ddubinin\downloads\mysql-connector-c-6.1.6-src\include\my_global.h 682
I'll close this issue, managed to compile the source with an older ,VS2013 x64, version of Visual Studio, and CMake 4.3.1 ...
It seems, the new changes in Visual Studio 2015 are breaking the C connector source code, I hope that MySQL team will fix this in a future release.
i used mysql server code(i.e. mysql-5.7.13.zip) and compiled the MySQL Connector/C from it.
What motivated me to compile this code in vs 2015 is when I compiled mysqlcppconn 1.1.8, I got the error:
error LNK2038:mismatch detected for `_MSC_VER`:value '1800' does not match value '1900'
the 1800,1900 indicates the version of vs used.
MSVC++14.0 _MSC_VER == 1900 (Visual Studio 2015)
MSVC++12.0 _MSC_VER == 1800 (Visual Studio 2013)
MSVC++11.0 _MSC_VER == 1700 (Visual Studio 2012)
MSVC++10.0 _MSC_VER == 1600 (Visual Studio 2010)
MSVC++9.0 _MSC_VER == 1500 (Visual Studio 2008)
MSVC++8.0 _MSC_VER == 1400 (Visual Studio 2005)
MSVC++7.1 _MSC_VER == 1310 (Visual Studio 2003)
MSVC++7.0 _MSC_VER == 1300
MSVC++6.0 _MSC_VER == 1200
MSVC++5.0 _MSC_VER == 1100
I searched and discovered that it indicates my mysqlcppconn-static.lib downloaded from mysql was compiled using VS 2013, and it causes error in VS 2015.
I acctually followed this guide, and it worked fine for me.
http://nov11.github.io/jekyll/update/2017/04/24/compilemysqlcppconnector1.1.8.html
My os is windows 10 x86
To summarize, Follow the steps:
git clone mysqlcppconn source code and checkout the desired version
git clone https://github.com/mysql/mysql-connector-cpp.git
git checkout 1.1.8
download boost and mysql-server-code locally, and modify the CMakeLists.txt so the compiler can find the library
In that case, my boost version is boost_1_64_0, and mysql is mysql-5.6.26-win32. It can be downloaded here:https://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.26-win32.zip
modify CMakeLists.txt, add lines:
SET(BOOST_ROOT "C:\\boost_1_64_0")
SET(MYSQL_DIR "C:\\mysql-5.6.26-win32")
SET(MYSQL_VERSION "5.6.26")
cmake:
mkdir build && cd build
cmake -G "Visual Studio 14 2015" -A win32 -DMYSQLCLIENT_STATIC_LINKING=yes ..
solve the snprintf link error:
comment out the define snprintf _snprintf line in my_config.h in mysql-server-include code
generate lib files:
cmake --build <your-build-folder-path> --config Release --target mysqlcppconn -j 4 --
cmake --build <your-build-folder-path> --config Release --target mysqlcppconn-static -j 4 --

Compiling boost 1.57 with intel compiler

I tried to compile boost 1.57 with intel compiler and I got a error message:
*** argument error
* rule get-msvc-version-from-vc-string ( vc-string )
* called with: ()
* missing argument vc-string
Do you know how can I solve this problem.
Thank you
As you can see here the right command to use from an intel command prompt (after bootstrap.bat in order to compile b2.exe) is
b2 toolset=intel-14.0-vc12
instead of
b2 toolset=intel
14.0-vc12 because probably the version of your Intel compiler was 14.xx.xx (check it running icl command) and your Visual Studio version was 2012/2013.

constexpr not compiling in VC2013

This constexpr code does not compiled in Visual Studio 2013 version 12.0.21005.1 REL
Is there a newer Visual Studio compiler that works with constexpr?
#include <iostream>
constexpr int factorial(int n)
{
return n <= 1 ? 1 : (n * factorial(n - 1));
}
int main(void)
{
const int fact_three = factorial(3);
std::cout << fact_three << std::endl;
return 0;
}
output from compilation:
1>------ Build started: Project: Project1, Configuration: Debug Win32 ------
1> Source.cpp
1>....\source.cpp(3): error C2144: syntax error : 'int' should be preceded by ';'
1>....\source.cpp(3): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Herb Sutter mentions constexpr on his blog but is unclear in what version it works / will work? http://herbsutter.com/2013/09/09/visual-studio-2013-rc-is-now-available/#comment-13521
Microsoft publishes a C++11 compatibility table, under which constexpr is clearly marked as not being available in Visual Studio 2013.
The November 2013 CTP has it, though.
Source: Google visual studio constexpr
constexpr is not supported in Visual Studio 2013 RTM, see the compatibility table. This is not only true for the RTM version, but also for the Visual Studio Updates.
If you want to stick to Visual Studio 2013, you could download the Visual C++ Compiler November 2013 CTP which comes with some new features, see MSDN blog. Unfortunately Microsoft has no merger with the latest Visual Studio Update features and the CTP features and clearly states that they don't plan to do so.
If we want it all, we need to wait for Visual Studio 2015, see the MSDN blog about VS 2015 Preview.
As is mentioned by the others, November 2013 Customer Technology Preview(CTP) will give you access to constexpr*
Note that just downloading the you'll need to change your "Platform Toolset" to "Visual C++ Compiler Nov 2013 CTP (CTP_Nov2013)" to use the new compiler. You can do that by opening your project's "Property Pages" And going to: "Configuration Properties" > "General" and then changing the "Platform Toolset".
*There is a bit of conflicting information on what portion of constexpr you actually have access to, but it's definitely not all of the standards definition of constexpr. Microsoft says here that the November 2013 CTP adds:
constexpr support (except for constructors)
Microsoft say here that it contains:
constexpr (except for member functions)
I can't even test if it has support for member functions, cause it definitely doesn't have support for any type of constexpr construction. For example this code gives this error with the November 2013 CTP:
error C2127: illegal initialization of 'constexpr' entity with a non-constant expression
One additional note: At time of writing the Visual Studio 2015 Preview still does not support constexpr construction. Keeping my fingers crossed on the final release.
You need to install VS2013 Update 5. (I was on Update 3 and it was not working)
The thing about "Nov 2013 CTP" was inapplicable, as of this writing.
You can do so by going here: https://my.visualstudio.com
and going to download, or :
https://my.visualstudio.com/Downloads?q=visual%20studio%202013

Smart pointer: runtime crash in VS 9 running WinXP-Sp3

I am getting run time crash in the following piece of code and not able to debug also. Please review and let me know what's going on.
// CppConsole.cpp : Defines the entry point for the console application.
//#include "stdafx.h"#include <iostream>#include <assert.h>
class Test : public std::tr1::enable_shared_from_this<Test>
{
public:
Test():x(0),y(0),z(0){};
int x;
float y;
double z;
};
int _tmain(int argc, _TCHAR* argv[])
{
std::tr1::shared_ptr<Test> t1(new Test);
std::tr1::shared_ptr<Test> t2 = t1->shared_from_this();
return 0;
}
I have include all the headers and the program is compiling fine. This is the error i am getting:
CppConsole.exe - Entry Point Not Found The procedure entry point
?_Xweak#tr1#std##YAXXZ could not be located in the dynamic link
library MSVCP90D.dll
If I comment out this line
std::tr1::shared_ptr t2 = t1->shared_from_this();
the program runs without crashing.
Update: Question can be closed for now. I will try to install VS feature pack and see weather the program executes without any crashes.
Googled it (The procedure entry point ?_Xweak),found this : http://blog.nilretain.org/
EDIT : I Build and Run it successfully on my msvc 2008 on xp-sp3 ,which has later version of msvcp90d.dll.
Maybe you can download and install the latest redist-version of msvc90 and rebuild.
EDIT: your dependencies says something is missing. check this out :
http://answers.yahoo.com/question/index?qid=20090623140325AAInugo
You need a template argument:
std::tr1::shared_ptr<Test> t1(new Test);
std::tr1::shared_ptr<Test> t2 = t1->shared_from_this();
The compiler should report an error if it is not present. (Visual C++ 2010 does)
It appears that your compiler is not linking against a DLL with the needed runtime functions. For instance, if you added the headers to your include path, but don't link to the latest version of the C++ runtime (check your project's settings), or installing the Visual C++ 2008 feature pack didn't work, or you installed the feature pack but then tried to compile from Visual Studio 2005, etc.
Basically the "process the source code (including headers)" step is working fine, but the "link all the DLLs" step is failing. And it's failing because the runtime you're linking against doesn't have the needed functions for shared_ptrs or weak_ptrs.
I had this problem when developing under M$ Windows SP3 with M$ Visual Studio 2008. I tried and combined many hints that I could find on the web. To no avail. The solution was simple, I had to install SP1 pack for M$ Visual Studio 2008!
The thing is that my external DLLs used C++ TR1 functions that I was not aware of. The M$ Visual Studio 2008 without SP does not have the right runtime DLLs.
So, just make sure you have that SP1 for your M$ Visual Studio 2008 first before trying any other solution.