[geos-devel] Building GEOS on Windows

HA hadev at altern.org
Tue Jan 27 18:24:31 EST 2004


Hi,

I have just downloaded geos-1.0.0.tar.gz 
<http://geos.refractions.net/geos-1.0.0.tar.gz>, and compiled it under 
VC++6. I have not tested it yet (it lacks the test suite of JTS), so be 
warned, the modifications I had to do may have unwanted side-effects....

Here is how I proceeded:

    * Create a project under VC6 (a static lib is easier for now, you
      will not need to define the DLL exported symbols).

    * add all the cpp files to your project.

    * in "Project Settings" / Tab "C/C++" / Category "C++ language"
      enable Run-Time Type Information (RTTI) or add the /GR flag to the
      compiler options, so you will be able to do things like
      |dynamic_cast<...>|

    *  in platform.h, undefine HAVE_LONG_LONG_INT_64 (I have not checked
      the implications of this...)

    * VC6 complains about symbol redefinition (error C2374) when two
      contiguous loops use the same loop index identifier, eg:

    for(int i=0; ...) {...}
    for(int i=0; ...) {...}

    The solution is to rename the second loop index (|j| seems a good
    choice :-), or to upgrade to a more C++ compliant compiler... be
    carefull to rename all the occurences of i within the loop scope.

    * There are a *LOT* of C4786 warnings "identifier was truncated to
      255 characters in the debug information", so use |#pragma
      warning(disable:4786)| to disable it (or disable all warnings, but
      you may want to see other warnings)

    * I had the following compilation error: "C2248: 'IntersectsOp' :
      cannot access protected class declared in class
      'geos::AbstractSTRtree'" that I resolved by making the IntersectOp
      inner class public. I am not a C++ standard specialist (in fact I
      am a Java guy), but I was surprised it did not compile...

    * In PolygonBuilder.cpp, the following line did not compile:

    |freeHoleList->insert(freeHoleList->end(),minEdgeRings->begin(),minEdgeRings->end());|

    The MS STL implementation bundled with VC6 is not the best you can
    find. You may want to try STLPort (www.stlport.org). If this sounds
    too complicated for you, I think the following lines are equivalent
    (if it is not, please tell me):

    |vector<MinimalEdgeRing*>::iterator end = minEdgeRings->end();|
    |for(vector<MinimalEdgeRing*>::iterator it=minEdgeRings->begin();
    it!=end; it++)|
    |{|
    |    freeHoleList->push_back(*it);|
    |}
    |

    * strangely, VC6 does not know about min() and max() functions, so
      use |#define min __min| and |#define max __max|

Here we are. I think you should be able to compile now, unless I have 
forgotten to mension some other problem. If you need to stick to C++, 
maybe should you upgrade to Visual C++ .NET, I have heard it is much 
more C++ compliant than VC++6, and maybe it is bundled with a more 
complete STL implementation.

Or switch to Java, and use JTS :-)  If I manage to realize some 
performance tests with GEOS, I will compare them with their equivalent 
in JTS, but I am quite sure that Java will be quite as fast as C++, the 
latest Java virtual machines being indeed really fast.

Regards,

Hervé



Swapna kv wrote:

>
> Hi
>
>    Has anyone succesfully built GEOS on Windows platform using VC. We 
> have been unable to do so. Can anyone give any pointers / VC project 
> files to help us do so.
>
>
> Regards
> Swapna
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geos-devel/attachments/20040128/45e55fb9/attachment.html


More information about the geos-devel mailing list