Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #101589
| From | Michael Holiday <Mike@example.invalid> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: linking precedence rules |
| Date | 2017-01-13 01:58 -0800 |
| Message-ID | <edrmliFgh80U1@mid.individual.net> (permalink) |
| References | (1 earlier) <edeb2qF4e1sU1@mid.individual.net> <edef9tF8tn5U1@mid.individual.net> <s8j57c9s06a8iodjk2oovsn409gadcr1ev@4ax.com> <edpa7vFt8c3U1@mid.individual.net> <87vatkquaq.fsf@bsb.me.uk> |
On 1/12/2017 5:31 AM, Ben Bacarisse wrote:
> Michael Holiday <Mike@example.invalid> writes:
> <snip>
>> whether parsing has been performed. If I write the standard "hello
>> world" program, how do I figure out which stdio.h is being used from
>> the compiler's perspective?
>
> If you are using a gcc-derived compiler, you might find it has a -M
> option. This is intended for generating make files, but it has the
> effect of showing you what files your source depends on which includes
> all the systems files included either directly or indirectly.
>
C:\Users\Fred\Documents\Win32-LongPath-master\Win32-LongPath-master\iuy\Win32-LongPath-master>gcc
-o differ -Wall diff1.c -IC:\MinGW\include
/mingw/lib/libmingw32.a(setargv.o):(.text+0x33): undefined reference to
`__chkstk_ms'
...
/mingw/lib/libmingwex.a(glob.o):(.text+0xb2e): more undefined references
to `__chkstk_ms' follow
collect2: ld returned 1 exit status
I took some C source from
http://clc-wiki.net/wiki/K%26R2_solutions:Chapter_7:Exercise_6 , and
added one more standard header, clearing the diagnostics which, I
believe, precede the linking stage.
Then I thought, alright then, time to use that -M flag. I was expecting
a bunch of parsed C in some form, but the command succeeds in creating
an executable. When run, I get a window that tells me that a 16-bit
application is not what this version of windows is gonna deal with:
C:\Users\Fred\Documents\Win32-LongPath-master\Win32-LongPath-master\iuy\Win32-LongPath-master>gcc
-o differ -Wall diff1.c -M -IC:\MinGW\include
C:\Users\Fred\Documents\Win32-LongPath-master\Win32-LongPath-master\iuy\Win32-LongPath-master>differ
Makefile Makefile.bak
This version of
C:\Users\Fred\Documents\Win32-LongPath-master\Win32-LongPath-master\iuy\Win32-LongPath-master\differ.exe
is not compatible with the version of Windows you're running. Check your
computer's system information and then contact the software publisher.
C:\Users\Fred\Documents\Win32-LongPath-master\Win32-LongPath-master\iuy\Win32-LongPath-master>type
diff1.c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAXLINE 1000
void diff_line( char *lineone, char *linetwo, int linenumber )
{
if(strcmp (lineone, linetwo) < 0 || strcmp (lineone, linetwo) > 0)
printf( "%d<%s\n%d>%s\n", linenumber, lineone, linenumber, linetwo);
}
int main(int argc, char *argv[] )
{
FILE *fp1, *fp2;
char fp1_line[MAXLINE], fp2_line[MAXLINE];
int i;
if ( argc != 3 )
{
printf("differ fileone filetwo\n");
exit(0);
}
fp1 = fopen( argv[1], "r" );
if ( ! fp1 )
{
printf("Error opening file %s\n", argv[1]);
}
fp2 = fopen( argv[2], "r" );
if ( ! fp2 )
{
printf("Error opening file %s\n", argv[2]);
}
i = 0;
while ( (fgets(fp1_line, MAXLINE, fp1) != NULL)
&& (fgets(fp2_line, MAXLINE, fp2) != NULL))
{
diff_line( fp1_line, fp2_line, i );
i++;
}
return 0;
}
The above is completely-standard C. How do I get this thing hooked up right?
--
Michael
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-07 23:49 -0800
Re: linking precedence rules Ian Collins <ian-news@hotmail.com> - 2017-01-08 21:20 +1300
Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-08 01:32 -0800
Re: linking precedence rules "James R. Kuyper" <jameskuyper@verizon.net> - 2017-01-08 11:08 -0500
Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-12 03:25 -0800
Re: linking precedence rules Noob <root@127.0.0.1> - 2017-01-12 13:31 +0100
OT Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-14 01:18 -0800
Re: linking precedence rules Barry Schwarz <schwarzb@dqel.com> - 2017-01-08 15:38 -0800
Re: linking precedence rules "James R. Kuyper" <jameskuyper@verizon.net> - 2017-01-08 18:46 -0500
Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-12 04:13 -0800
Re: linking precedence rules Richard Heathfield <rjh@cpax.org.uk> - 2017-01-12 12:21 +0000
Re: linking precedence rules Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-15 00:23 -0800
Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-16 06:20 -0800
Re: linking precedence rules Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-30 05:10 -0800
Re: linking precedence rules Manfred <noname@invalid.add> - 2017-02-04 17:12 +0100
Re: linking precedence rules Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-08 20:47 -0800
Re: linking precedence rules Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-12 13:31 +0000
Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-13 01:58 -0800
Re: linking precedence rules Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-13 10:41 +0000
Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-14 03:49 -0800
Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-14 12:03 +0000
Re: linking precedence rules David Brown <david.brown@hesbynett.no> - 2017-01-14 14:02 +0100
Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-14 13:46 +0000
Re: linking precedence rules gazelle@shell.xmission.com (Kenny McCormack) - 2017-01-14 14:23 +0000
Re: linking precedence rules Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-14 14:31 +0000
Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-14 16:18 +0000
Re: linking precedence rules David Brown <david.brown@hesbynett.no> - 2017-01-14 17:49 +0100
Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-14 17:21 +0000
Re: linking precedence rules Ian Collins <ian-news@hotmail.com> - 2017-01-15 10:12 +1300
Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-14 21:59 +0000
Re: linking precedence rules supercat@casperkitty.com - 2017-01-14 14:12 -0800
Re: linking precedence rules Ian Collins <ian-news@hotmail.com> - 2017-01-15 11:39 +1300
Re: linking precedence rules Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-01-14 16:03 -0800
Re: linking precedence rules raltbos@xs4all.nl (Richard Bos) - 2017-01-18 11:51 +0000
Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-15 02:04 -0800
Re: linking precedence rules David Brown <david.brown@hesbynett.no> - 2017-01-14 23:48 +0100
Re: linking precedence rules Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-14 20:28 +0000
The Unix way vs. the Windows way (Was: linking precedence rules) gazelle@shell.xmission.com (Kenny McCormack) - 2017-01-14 14:14 +0000
Re: The Unix way vs. the Windows way (Was: linking precedence rules) BartC <bc@freeuk.com> - 2017-01-14 14:29 +0000
Re: The Unix way vs. the Windows way (Was: linking precedence rules) supercat@casperkitty.com - 2017-01-14 14:20 -0800
Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-15 01:40 -0800
Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-15 11:43 +0000
Re: linking precedence rules antispam@math.uni.wroc.pl - 2017-01-18 19:55 +0000
Re: linking precedence rules Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-14 14:22 +0000
Re: comparison logic Noob <root@127.0.0.1> - 2017-01-13 16:05 +0100
Re: comparison logic Richard Heathfield <rjh@cpax.org.uk> - 2017-01-13 15:37 +0000
Re: comparison logic Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-13 16:06 +0000
Re: comparison logic Noob <root@127.0.0.1> - 2017-01-13 19:37 +0100
Re: comparison logic BartC <bc@freeuk.com> - 2017-01-13 18:42 +0000
Re: comparison logic Richard Heathfield <rjh@cpax.org.uk> - 2017-01-13 18:49 +0000
Re: comparison logic Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-13 20:50 +0000
Re: comparison logic Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-14 01:05 -0800
Re: comparison logic Michael Holiday <Mike@example.invalid> - 2017-01-14 01:27 -0800
Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-01-14 13:56 -0800
Re: comparison logic Richard Heathfield <rjh@cpax.org.uk> - 2017-01-15 14:45 +0000
Re: comparison logic Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-15 20:42 -0800
Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-01-15 21:04 -0800
Re: comparison logic Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-30 04:47 -0800
Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-01-30 11:40 -0800
Re: comparison logic Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-03 16:42 -0800
Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-02-03 18:45 -0800
Re: comparison logic Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-08 21:03 -0800
Re: comparison logic supercat@casperkitty.com - 2017-02-09 08:07 -0800
Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-02-09 08:50 -0800
Re: comparison logic supercat@casperkitty.com - 2017-02-09 12:15 -0800
Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-02-09 12:38 -0800
Re: comparison logic supercat@casperkitty.com - 2017-02-09 14:13 -0800
Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-02-09 14:45 -0800
Re: comparison logic Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-12 10:20 -0800
Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-12 14:32 +0000
Re: linking precedence rules James Kuyper <jameskuyper@verizon.net> - 2017-01-12 13:33 -0500
csiph-web