Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Build errors using VS2015 #178

Open
kmsomebody opened this issue Jun 28, 2016 · 1 comment
Open

Build errors using VS2015 #178

kmsomebody opened this issue Jun 28, 2016 · 1 comment

Comments

@kmsomebody
Copy link

So, this is more of an enhancement than an actual issue, since I solved it myself, but wanted you people to know:

I was trying to compile pagmo just with boost in VS2015, Windows 10, x64.
There was a compiler error (C3848), "[...] would lose some const-volatile qualifiers [...]" somewhere in "xtree" (which is located in the VS directory).

So, here is how I fixed it:
In hv3d.cpp / hv3d.h change this function

bool hv3d::hycon3d_tree_cmp::operator()(const std::pair<fitness_vector, int> &a, const std::pair<fitness_vector, int> &b)

to const.

bool hv3d::hycon3d_tree_cmp::operator()(const std::pair<fitness_vector, int> &a, const std::pair<fitness_vector, int> &b) const

Also, there was another error in inverover.cpp line 266, saying that abs is ambiguous.

stop = (abs(pos1_c1-pos1_c2)==1 || static_cast<problem::base::size_type>(abs(pos1_c1- pos1_c2))==Nv-1);

Casting the parameters to long long fixed it.

stop = (abs((long long)pos1_c1-(long long)pos1_c2)==1 || static_cast<problem::base::size_type>(abs((long long)pos1_c1- (long long)pos1_c2))==Nv-1); 

I hope I could help, if anyone had the same problem.
Of course, if anyone has a better solution, I would like to know.

@p-snft
Copy link

p-snft commented Sep 19, 2018

I second this (for VS2017/ MSVC14.1). However, I suggest to use

static_cast<ptrdiff_t>(pos1_cN)

instead of

(long long)pos1_cN

as pos1_cN are size_t.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants