JCash / voronoi

A C implementation for creating 2D voronoi diagrams
MIT License
632 stars 94 forks source link

Building a project with code from the voronoi fails in Visual Studio #78

Closed etonishev closed 1 year ago

etonishev commented 1 year ago

Steps to reproduce:

  1. Clone the code
  2. Create a new console project in the Visual Studio
  3. Add a new cpp file and put the following code there:
#include <iostream>
#include "jc_voronoi.h"

int main()
{
    return 0;
}
  1. Go to Solution Explorer -> Project Properties -> C/C++ -> General
  2. Add a path to the voronoi\src folder (of the cloned code) in Additional Include Directories property.
  3. Apply
  4. Try to build Solution by using hotkey Ctrl + B

As the result you will get the following error:

error C2526: 'jcv_delauney_begin': C linkage function cannot return C++ class 'jcv_delauneyiter' message : see declaration of 'jcv_delauneyiter'

My environment: Microsoft Visual Studio Professional 2022 (64-bit) - Version 17.4.4

etonishev commented 1 year ago

I try doing the same at home in Visual Studio Community 2022 (64-bit) - Version 17.4.3 and the project was built successfully.

Upd: Visual Studio Community 2022 (64-bit) - Version 17.4.4 builds the project without any problems too.

JCash commented 1 year ago

Thanks! I'll try to fix this warning today. It was an oversight on my part. It should be easy to fix by passing in a pointer to the iterator when creating it.

etonishev commented 1 year ago

@JCash could you explain why it happens, please? I can't find a good article about this problem in VS.

JCash commented 1 year ago

Compile issue is now fixed in https://github.com/JCash/voronoi/releases/tag/v0.9.0