www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000303

When Created: 09/28/1999 12:00:34
Against DJGPP version: 2.02
By whom: bruce.e.riggins@boeing.com
Abstract: Parse error where no syntax error exists.
My problem is the following:
============================

Sample file produces parse error where I do not believe there is any syntax or program structure problem.
Try compiling the given project (tok.gpr).

Project includes the following files:
tok.c
--------------- start
#include "tok.h"
--------------- end

tok.h
--------------- start
extern "C"
{
}
--------------- end

Simply create tok.c and tok.h, with contents found between the dashed lines.
Compile tok.c.  The error shows up.

I ran it in RHIDE as well, creating this report:
This is a bug report for RHIDE Version 1.4 (Sep 30 1997 23:06:59)
I am running MS-DOS 7.0 (Windows 95)

Important environment variables:
PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;E:\BR\TSE_BETA;C:\BR\UTIL;C:\BR\WINUTIL;D:\DJGPP\BIN;Z:.;W:.;X:.;Y:.
DJGPP=d:\djgpp\djgpp.env
LFN=y
INFOPATH=d:/djgpp/info;d:/djgpp/gnu/emacs/info
LOCALEDIR=
LANGUAGE=
SHELL=
COMSPEC=C:\WINDOWS\COMMAND.COM
DJSYSFLAGS=

Here is the output from a sample compilation and link for C
executing:
echo "int main(){return 0;}" | redir -eo gcc -Xlinker -v -Wa,-v -v -o /dev/null -x c -
Reading specs from d:/djgpp/lib/specs
gcc version 2.95 19990728 (release)
 d:/djgpp/lib/gcc-lib/djgpp/2.95/cpp.exe -lang-c -v -isystem d:/djgpp/bin/include -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dunix -Di386 -DGO32 -DMSDOS -DDJGPP=2 -DDJGPP_MINOR=2 -D__unix__ -D__i386__ -D__GO32__ -D__MSDOS__ -D__DJGPP__=2 -D__DJGPP_MINOR__=2 -D__unix -D__i386 -D__GO32 -D__MSDOS -D__DJGPP=2 -D__DJGPP_MINOR=2 - d:/djgpp/tmp/RHaaaaaa\ccZnnoW2.i
GNU CPP version 2.95 19990728 (release) (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 d:/djgpp/include
 d:/djgpp/lib/gcc-lib/djgpp/2.95/include
 d:/djgpp/include
End of search list.
The following default directories have been omitted from the search path:
 $DJDIR/lang/cxx
 $DJDIR/lib/gcc-lib/djgpp/2.95/../../../../djgpp/include
End of omitted list.
 d:/djgpp/lib/gcc-lib/djgpp/2.95/cc1.exe d:/djgpp/tmp/RHaaaaaa\ccZnnoW2.i -m486 -malign-jumps=2 -malign-loops=2 -malign-functions=2 -quiet -dumpbase -.c -version -o d:/djgpp/tmp/RHaaaaaa\cc8ZtNH6.s
GNU C version 2.95 19990728 (release) (djgpp) compiled by GNU C version 2.95 19990728 (release).
:1: parse error before string constant

End of the sample

Here is the output from a sample compilation and link for C++
executing:
echo "int main(){return 0;}" | redir -eo gcc -Xlinker -v -Wa,-v -v -o /dev/null -x c++ -
Reading specs from d:/djgpp/lib/specs
gcc version 2.95 19990728 (release)
 d:/djgpp/lib/gcc-lib/djgpp/2.95/cpp.exe -lang-c++ -v -isystem d:/djgpp/bin/include -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Dunix -Di386 -DGO32 -DMSDOS -DDJGPP=2 -DDJGPP_MINOR=2 -D__unix__ -D__i386__ -D__GO32__ -D__MSDOS__ -D__DJGPP__=2 -D__DJGPP_MINOR__=2 -D__unix -D__i386 -D__GO32 -D__MSDOS -D__DJGPP=2 -D__DJGPP_MINOR=2 -D__EXCEPTIONS - d:/djgpp/tmp/RHaaaaaa\ccXbOQWK.ii
GNU CPP version 2.95 19990728 (release) (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 d:/djgpp/lang/cxx
 d:/djgpp/include
 d:/djgpp/lang/cxx
 d:/djgpp/lib/gcc-lib/djgpp/2.95/include
 d:/djgpp/include
End of search list.
The following default directories have been omitted from the search path:
 $DJDIR/lib/gcc-lib/djgpp/2.95/../../../../djgpp/include
End of omitted list.
 d:/djgpp/lib/gcc-lib/djgpp/2.95/cc1plus.exe d:/djgpp/tmp/RHaaaaaa\ccXbOQWK.ii -m486 -malign-jumps=2 -malign-loops=2 -malign-functions=2 -m486 -malign-jumps=2 -malign-loops=2 -malign-functions=2 -quiet -dumpbase -.cc -version -o d:/djgpp/tmp/RHaaaaaa\ccCnNGgG.s
GNU C++ version 2.95 19990728 (release) (djgpp) compiled by GNU C version 2.95 19990728 (release).
:1: parse error before string constant

End of the sample

Solution added: 09/28/1999 13:00:00
By whom: bruce.e.riggins@boeing.com
Rename the source file to .cpp or .cc
The problem is in the .c extension.  GCC does not recognize the C++ syntax.

Note added: 09/29/1999 11:00:58
By whom: broeker@physik.rwth-aachen.de
This is not a DJGPP bug. 'extern "C" { }' is a C++ only syntax,
but the filename suggested that the program to be compiled was a C
one. 

I'm closing this (not 'fixing', because there was nothing broken,
to begin with).

Closed on 09/29/1999 11:00:33: Non-bug: usage error (and not even of DJGPP proper).
By whom: broeker@physik.rwth-aachen.de



  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010