[GRASS-dev] C syntax and the use of underscore ('_')

Rob Parsons jrobparsons at gmail.com
Mon Aug 24 22:08:47 PDT 2015


Ok.
I am getting smarter.

Forget what I said about using the -std=c99  option to get Eclipse to
recognize the _() macro. The syntax error being reported by the Eclipse
editor (CDT parser) is caused be the definition of PACKAGE on the gcc
command line.

-DPACKAGE=\""grassmods"\"

Eclipse invokes the GRASS 'make default' tool and builds the system or
module with no problem. The Eclipse parser/indexer builds its database of
symbols and cross-references by scanning all the C/C++ source code, Python
scripts and make output.

It learns that the value of PACKAGE is the string:

\""grassmods"\"


This value is OK when building the system or module because the build is
performed within a MSYS shell.

The Eclipse editor and CDT parser likes this value:

"grassmods"

I am not suggesting any kind of change. The _() macro works. I can
successfully compile and from within Eclipse. The 'syntax error' is more of
a nuisance than anything else. Maybe I can figure out how to tell Eclipse
to ignore this syntax.

Eclipse 4.5 Mars for GRASS development on Windows 7 is working very well. I
can browse, build, run, debug GRASS C/C+ modules and Python scripts.

I will document this on the wiki.


Rob Parsons
Raleigh NC



On Mon, Aug 3, 2015 at 8:57 AM, Markus Neteler <neteler at osgeo.org> wrote:

> On Mon, Aug 3, 2015 at 2:26 PM, Rob Parsons <jrobparsons at gmail.com> wrote:
> > Telling Eclipse that the C dialect is c99 (-std=c99) solved the problem.
> The
> > macro is now recognized.
>
> Excellent. Please consider to update the page
> http://grasswiki.osgeo.org/wiki/Eclipse
>
> in order to help others with the hint(s) which easily get lost in the
> email archive.
>
> Markus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20150825/0ed5c588/attachment.html>


More information about the grass-dev mailing list