This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

More problems with make





I have got my makefile to work correctly with some simple C. I have now got some
 more
complicated C code, that sends two queries to sybase SQL Server in a command
batch.  It binds each set
of results and prints the rows.

The code is syntactically correct.

I want to run make on my makefile so that it produces an "example1" exe. Now my
makefile
is as follows, and as far as I can see, it is correct:

===========================

#
# Comments
#

INCDIR = /d5/OCS-12_5/include
LIBDIR = /d5/OCS-12_5/lib
HEADERS = $(INCDIR)/sybfront.h \
        $(INCDIR)/sybdb.h
DBLIBS = $(LIBDIR)/libsybdb.a
OBJS = errhandler.o msghandler.o error.o \
        chkintr.o dberror.o handler.o hndlintr.o

INCLUDE = -I -I$(INCDIR) -I../include
CFLAGS = $(INCLUDE) -lm
OFLAGS = $(INCLUDE) -c

example1: $(HEADERS) $(OBJS) example1.c
        $(GCC) example1.c $(OBJS) $(DBLIBS) $(CFLAGS) -o example1


===========================

All the files for OBJS, HEADERS, INCDIR etc.. exist.

However, when I run make -f makefile it comes back with the following error
messages:

./example1.c: static: not found
./example1.c: syntax error at line 13: `(' unexpected
make: *** [example1] Error 2

Could somebody tell me:

a) What "static: not found" means?
b) What "Error 2" means?

Any additional info would be much appreciated.

===========================================
#if USE_SCCSID
static char Sccsid[] = {"@(#) example1.c 87.1 12/29/93"};
#endif

#include <stdio.h>
#include <sybfront.h>
#include <sybdb.h>
#include "sybdbex.h"

#define DATELEN     26
#define TYPELEN      2

int CS_PUBLIC   err_handler();
int CS_PUBLIC   msg_handler();

main(argc, argv)
int             argc;
char            *argv[];
{
     DBPROCESS     *dbproc;       /* Our connection with SQL Server. */
     LOGINREC      *login;        /* Our login information. */

     DBCHAR         crdate[DATELEN+1];
     DBINT          id;
     DBCHAR         name[DBMAXNAME+1];
     DBCHAR         type[TYPELEN+1];
     RETCODE        result_code;

     printf("Demo of SQL queries in a command batch\n\n");
     fflush(stdout);

     if (dbinit() == FAIL)
          exit(ERREXIT);

     dberrhandle((EHANDLEFUNC)err_handler);
     dbmsghandle((MHANDLEFUNC)msg_handler);

     login = dblogin();
     DBSETLUSER(login, USER);
     DBSETLPWD(login, PASSWORD);
     DBSETLAPP(login, "example1");

     dbproc = dbopen(login, NULL);

     dbcmd(dbproc, "select name, type, id, crdate from sysobjects");
     dbcmd(dbproc, " where type = 'S' ");
     dbcmd(dbproc, "select name, type, id, crdate from sysobjects");
     dbcmd(dbproc, " where type = 'P' ");

     dbsqlexec(dbproc);


     while ((result_code = dbresults(dbproc)) != NO_MORE_RESULTS)
     {
          if (result_code == SUCCEED)
          {
               /* Bind program variables. */

               dbbind(dbproc, 1, NTBSTRINGBIND, (DBINT)0,
                              (BYTE DBFAR *)name);
               dbbind(dbproc, 2, NTBSTRINGBIND, (DBINT)0,
                              (BYTE DBFAR *)type);
               dbbind(dbproc, 3, INTBIND, (DBINT)0, (BYTE *)&id);
               dbbind(dbproc, 4, NTBSTRINGBIND, (DBINT)0,
                              (BYTE DBFAR *)crdate);

               printf("\n %s Objects: \n\n",
               DBCURCMD(dbproc) == 1 ? "System Table": "Procedure");

               while (dbnextrow(dbproc) != NO_MORE_ROWS)
               {
                    if ((DBCURCMD(dbproc) == 2)
                         && (DBCURROW(dbproc) > 10))
                         continue;
                    printf
                         ("%s %s %d %s\n", name, type, id, crdate);
               }
          }
     }

     dbexit();
     exit(STDEXIT);
}

int CS_PUBLIC err_handler(dbproc, severity, dberr, oserr, dberrstr, oserrstr)
DBPROCESS       *dbproc;
int             severity;
int             dberr;
int             oserr;
char            *dberrstr;
char            *oserrstr;
{
     if ((dbproc == NULL) || (DBDEAD(dbproc)))
          return(INT_EXIT);
     else
     {
          fprintf (ERR_CH, "DB-Library error:\n\t%s\n", dberrstr);

          if (oserr != DBNOERR)
               fprintf (ERR_CH, "Operating-system error:\n\t%s\n", oserrstr);

          return(INT_CANCEL);
     }
}

int CS_PUBLIC msg_handler(dbproc, msgno, msgstate, severity, msgtext,
                srvname, procname, line)

DBPROCESS       *dbproc;
DBINT           msgno;
int             msgstate;
int             severity;
char            *msgtext;
char            *srvname;
char            *procname;
int       line;

{
     fprintf (ERR_CH, "Msg %d, Level %d, State %d\n",
             msgno, severity, msgstate);

     if (strlen(srvname) > 0)
          fprintf (ERR_CH, "Server '%s', ", srvname);
     if (strlen(procname) > 0)
          fprintf (ERR_CH, "Procedure '%s', ", procname);
     if (line > 0)
          fprintf (ERR_CH, "Line %d", line);

     fprintf (ERR_CH, "\n\t%s\n", msgtext);

     return(0);
}

=========================


*******************Internet Email Confidentiality Footer*******************


Privileged/Confidential Information may be contained in this message.  If you
are not the addressee indicated in this message (or responsible for delivery of
the message to such person), you may not copy or deliver this message to anyone.
In such case, you should destroy this message and kindly notify the sender by
reply email. Please advise immediately if you or your employer does not consent
to Internet email for messages of this kind.  Opinions, conclusions and other
information in this message that do not relate to the official business of my
firm shall be understood as neither given nor endorsed by it.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]