loicland / cut-pursuit

C++ implementation for the cut pursuit algorithm, with Matlab interfaces
MIT License
76 stars 24 forks source link

compile error on vs2019 #26

Open WanpengShao opened 4 years ago

WanpengShao commented 4 years ago

error C2440 initialization problem “”: can not covert from “boost::adj_list_edge_property_map<boost::directed_tag,CP::EdgeAttribute,CP::EdgeAttribute &,unsigned __int64,Property,Tag>”to“boost::adj_list_edge_property_map<boost::directed_tag,CP::EdgeAttribute,CP::EdgeAttribute &,unsigned long,CP::EdgeAttribute,boost::edge_bundle_t>” with [ T=float, Property=CP::EdgeAttribute, Tag=boost::edge_bundle_t ] and [ T=float ] graph_cut_segmentation D:\wpcode\graph_cut_segmentation\graph_cut_segmentation\CutPursuit\include\CutPursuit.h 453

I use the boost 1_64 version. Then I doubt it is the version problem. Then I also use the higher boost 1_67 version. But it still happend. So could you please how to fix the compile problem?

loicland commented 4 years ago

Hi,

are you compling with python or mex?

WanpengShao commented 4 years ago

Dear sir No, I have not use files in mex folder. I just use files in include fold. And I call the function in API file. Like this.

include

Call function: CP::cut_pursuit(n_ver, n_edg, n_obs, observations, graph_source, graph_target, edge_weight, node_weight, in_component, components, kRegulationStrength, 1.f, 2.f, 2.f); BR Shao

loicland commented 4 years ago

Are you using c++11 flag to compile? Are you using a 64 or 32 bit compiler? Which version of GCC?

Edit: actually I think I know what the problem is. You are using windows right? Can you add somewhere and let me know of the results?

std::cout << "Size of long int:" <<  sizeof(long) << std::endl;
WanpengShao commented 4 years ago

release x64, language standard is is set default. but I thin kit is higher version than c++11. VS may not have the GCC version, it use its own compiler. It is different form the GCC compiler. So I will try the GCC compiler to compile the code again. Thank you.

loicland commented 4 years ago

Like i said above, I think this is more linked to win64 use of LLP64 instead of Linux64, which uses LP64. I don't have access to a windows station, so I can't test it out. If you run the line above it will tell us wether or not this is the issue.

truebelief commented 1 year ago

It is an old issue now. For anyone who still faces the problem, I think the solution can be simply replacing long unsigned int with unsigned __int64 in the Graph.h, i.e.


using EdgeAttributeMap = boost::adj_list_edge_property_map<
boost::directed_tag, EdgeAttribute<T>, EdgeAttribute<T> &
, long unsigned int, CP::EdgeAttribute<T>, boost::edge_bundle_t>;

with

using EdgeAttributeMap = boost::adj_list_edge_property_map<
boost::directed_tag, EdgeAttribute<T>, EdgeAttribute<T> &
, unsigned __int64, CP::EdgeAttribute<T>, boost::edge_bundle_t>;

using boost 1.65