[GRASS-dev] error compiling grass on windows using cygwin

Hi,

I have installed 6.2.3 version on windows and trying to compile r.example using cygwin. I am using below command from folder path: /usr/local/grass-6.2.3 where I have placed the source file.

$ gcc -I ./include main.cpp

On executing the above command, I get an error: ‘undefined reference to G_gisinit’ (also for all other functions used in r.example ).

All the .h files are available at “./include/grass/gis.h”. I also included the necessary .h files in the code.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <grass/gis.h>
#include <grass/Vect.h>
#include <grass/dbmi.h>
#include <grass/gisdefs.h>

As per my understanding this error can occur during linking when compiler is not able to find the function definition.

Please help me in resolving this error.

Regards,
Kartik

Please do not print this email unless it is absolutely necessary.

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com

kartik.ballal@wipro.com wrote:

I have installed 6.2.3 version on windows and trying to compile
r.example using cygwin. I am using below command from folder path:
/usr/local/grass-6.2.3 where I have placed the source file.

                    $ gcc -I ./include main.cpp

On executing the above command, I get an error: 'undefined reference to
G_gisinit' (also for all other functions used in r.example ).

You have to link against the relevant libraries, e.g.:

  gcc ... -L./lib -lgrass_gis

--
Glynn Clements <glynn@gclements.plus.com>