delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/20/02:44:49

From: "Colin W. Glenn" <cwg01 AT gnofn DOT org>
Newsgroups: comp.os.msdos.djgpp
Subject: Am I forgetting an include or something?
Date: Sun, 19 Jan 1997 13:00:58 -0600
Organization: Greater New Orleans Free-Net
Lines: 87
Message-ID: <Pine.GSO.3.95.970119125358.28799D-100000@sparkie.gnofn.org>
Reply-To: "Colin W. Glenn" <cwg01 AT gnofn DOT org>
NNTP-Posting-Host: sparkie.gnofn.org
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I realize this is probably a series of stupid questions, but I really can't
find the answers in either: DJGPPFAQ.INF, GCC.INF, LIBC.INF.  Maybe I'm just 
looking for the wrong items.  Anyway, I oughta start with my invocation:

| set djgpp=c:\djgpp\djgpp.env
| set path=c:\djgpp\bin;%path%
| redir -e %4.err gcc -o %4.exe -l -Wall -v %4.c

The %4 is of course the program name, which is this little thing:

| #include <stdio.h>
| #include <file.h>
| #include <dir.h>
|
| struct ffblk f;
| char pattern[14];
|
| int main()
|  {
|   int done;
|   chdir("//light");
|   strcpy(pattern, "*.lgm");
|   done = findfirst(pattern, &f, 0);
|   while(!done)
|    {
|     printf("%u %s\n", f.ff_fsize, f.ff_name);
|     done = findnext(&f);
|    }
|   exit(0);
|  }

(Yes, I copied part of it out of LIBC.INF, I'm learning the syntax, ok?)

Here is the output of GCC:

| Reading specs from c:/djgpp/lib\specs
| gcc version 2.7.2.1
|
|  c:/djgpp/bin\cpp.exe -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=7
|    -Dunix -Di386 -DGO32 -DMSDOS -DDJGPP=2 -DDJGPP_MINOR=1 -D__unix__
|    -D__i386__ -D__GO32__ -D__MSDOS__ -D__DJGPP__=2 -D__DJGPP_MINOR__=1
|    -D__unix -D__i386 -D__GO32 -D__MSDOS -D__DJGPP=2 -D__DJGPP_MINOR=1
|    -Wall LISTDIR.c c:/djgpp/tmp\ccbaaaaa
|
| GNU CPP version 2.7.2.1 (80386, BSD syntax)
| #include "..." search starts here:
| #include <...> search starts here:
| c:/djgpp/include
|  c:/djgpp/contrib/grx20/include
|  /usr/local/include
|  /usr/local/go32/include
|  /usr/local/lib/gcc-lib/go32/2.7.2.1/include
|  /usr/include
| End of search list.
|
|  c:/djgpp/bin\cc1.exe c:/djgpp/tmp\ccbaaaaa -quiet -dumpbase LISTDIR.c -Wall
|    -version -o c:/djgpp/tmp\cccaaaaa
|
| GNU C version 2.7.2.1 (80386, BSD syntax) compiled by GNU C version 2.7.2.1.
| LISTDIR.c: In function `main':
| LISTDIR.c:17: warning: unsigned int format, long unsigned int arg (arg 2)
|  c:/djgpp/bin\as.exe -o c:/djgpp/tmp\ccdaaaaa c:/djgpp/tmp\cccaaaaa
|
|  c:/djgpp/bin\ld.exe -o LISTDIR.exe c:/djgpp/lib\crt0.o -Lc:/djgpp/lib -l
|    c:/djgpp/tmp\ccdaaaaa -Tdjgpp.djl -lgcc -lc -lgcc
|
| c:/djgpp/bin\ld.exe: cannot open -lc:/djgpp/tmp\ccdaaaaa: No such file or
|   directory (ENOENT)

Well after examining the structure in DIR.H, I of course looked in the 
LIBC.INF for the syntax of printf()ing a unsigned long and changed my 
printf() statement to this:

|     printf("%U %s\n", f.ff_fsize, f.ff_name);

But then I get this!

| LISTDIR.c: In function `main':
| LISTDIR.c:17: warning: unknown conversion type character `U' in format
| LISTDIR.c:17: warning: format argument is not a pointer (arg 2)
| LISTDIR.c:17: warning: too many arguments for format

So like, am I overlooking something?

P.S., as.exe also produces the 'o' file, I used a undelete on the TMP dir and 
it exists, so why does ld.exe fail?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019