[rttopo-dev] Compile errors with Visual Studio 2012

Jeff McKenna jmckenna at gatewaygeomatics.com
Tue Jun 27 07:01:47 PDT 2017



On 2017-06-27 5:25 AM, a.furieri at lqt.it wrote:
> On Mon, 26 Jun 2017 10:57:41 -0300, Jeff McKenna wrote:
>> Hi all,
>>
>> I am trying to add librttopo support on Windows (for spatialite) for
>> the MS4W community, and when I try to compile librttopo master I get
>> the following errors with Visual Studio 2012:
>>
>>   https://git.osgeo.org/gogs/rttopo/librttopo/issues/24
>>
>> Please let me know if you need any more info, I can add it here or in
>> the ticket.
>>
> 
> Hi Jeff,
> 
> I've just been able to successfully build librttopo on MSVC 2015
> (I imagine it should work on earlier versions of MSVC as well).
> here is the basic recipe I've followed:
> 
> 1. I've downloaded the most recent version of the sources
>     available from the GIT repository:
>     https://git.osgeo.org/gogs/rttopo/librttopo/archive/master.zip
> 
> 2. then, from the MSVC own command prompt I've executed:
>     nmake /f makefile.vc >msvc-log.txt
> 
> ouch ... the build process stops prematurely because two
> header files are missing (both them are usually auto-generated
> on the fly by the ./configure script on Linux).
> 
> so I've simply copied what I already had from a previous MinGW
> build session (you'll find both headers into the attachment):
> 
> -/src/rttopo_config.h
> -/headers/librttopo_geom.h
> 
> 3. once again:
>     nmake /f makefile.vc >msvc-log.txt
> 
> and I was finally able to successfully complete my MSVC build.
> 
> NOTE: as you can easily check from the attached "msvc-log.txt"
> there are plenty of warnings (variables declared but never
> used, not-casted conversions from signed and unsigned values,
> not-ncasted roundings/truncations from doubles and floats and
> alike).
> 
> more or less the same identical issues are reported by MinGW
> and by GCC as well (see "mingw-log.txt"), so I intend that
> all them should be simply considered as symptoms of a someway
> "dirty" code, but they should be rather harmless.
> 
> please let me know if the same recipe works for you on
> MSVC 2012; if yes I'll then try to patch the code so to
> properly support a clean MSVC build.
> 
> I'm basically thinking about a solution like:
> 
> #if defined(_WIN32) && !defined(__MINGW32__)
> #include "librttopo_geom_msvc.h"
> #else
> #include "librttopo_geom.h"
> #endif
> 

Hi Sandro,

Thank you for trying with Visual Studio 2015.

Unfortunately, I had of course already hit those missing header issues, 
and I had solved them by copying from elsewhere, as you did. (I have 
filed a new ticket for your header issue: 
https://git.osgeo.org/gogs/rttopo/librttopo/issues/25)

No, the errors that I have reported, such as "missing ';' before 'type'" 
(see the exact errors in the ticket at 
https://git.osgeo.org/gogs/rttopo/librttopo/issues/24) are not the 
missing header errors, but are instead mostly due to the Visual Studio 
2012 compiler relying on the C89 standard, where variables must be 
declared at the beginning of the block.  (the Visual Studio 2015 
compiler that you tried does not require this)

I have seen other projects handle this requirement in the CFLAGS of the 
compiler (such as in MapCache: 
https://github.com/mapserver/mapcache/commit/219e54b45e4730b91111a6874e435a8ca8a1aa6d).

I hope this explains the issue better.

-jeff



-- 
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/





More information about the librttopo-dev mailing list