ANSI C question
Name:
Gvaz
2009-01-19 21:57
so I'm having problems with my first program in ANSI C (I'm using Cygwin)
So this is the contents of my "chall3.h" file:
#include <stdio.h>
main()
{
printf("Joe Shmoe\n");
}
And then in the shell, I type:
gcc chall3.h
And then when I try to do:
./chall3.h
I get the following error:
./chall3.h: line 4: syntax error near unexpected token '"Joe Shmoe\n"'
./chall3.h: line 4: 'printf("Joe Shmoe\n");'
Doing "mv chall3.h chall3.c" and repeating the whole deal with chall3.c instead of chall3.h changed nothing.
Any help would be greatly appreciated.
Name:
Anonymous
2009-01-19 22:10
You're not returning a value from main(). You should, otherwise you'll get undefined behaviour.
Name:
Anonymous
2009-01-19 22:17
"Joe Shmoe"
Name:
Anonymous
2009-01-19 22:28
why did you save it as .h instead of .c?
Name:
Anonymous
2009-01-19 22:29
Your compiler is fucked. Install Gentoo Linux.
Name:
Gvaz
2009-01-19 22:34
>>4
the book said to do it like that
Name:
Anonymous
2009-01-19 22:34
>>5
Now you have 1.9999999999999999999999999999998 problems
Name:
Anonymous
2009-01-19 23:45
>>5
☯ Please don't make troll posts!☯
Name:
Anonymous
2009-01-20 0:56
>>7
Now you have 1.9 problems
Name:
Anonymous
2009-01-20 2:24
>>9
I doubt you can properly store the number 1.
9
Name:
Anonymous
2009-01-20 2:38
>>10
int n = 1 + 9 / 9;
OH SHI-
Name:
Anonymous
2009-01-20 2:45
>>10
How hard is it to store an integer?
Name:
Anonymous
2009-01-20 3:19
please excuse my dear aunt sally
>>12
Name:
Anonymous
2009-01-20 3:44
Did I ever tell you guys about that time when I wrote an ANSI C compiler using only ANSI C? I was 12 back then.
Name:
Anonymous
2009-01-20 3:51
>>14
I don't know. That's hardly unique, so it could have been someone else that told us.
Name:
Anonymous
2009-01-20 7:47
>>14
I wrote mine as a batch file, when I was 4
Name:
Anonymous
2009-01-20 7:52
>>16
I wrote mine with angel patterns on a pin.
Name:
Anonymous
2009-01-21 23:48
When you do gcc myfile.c you'll get an output file, for example a.out. Try running that instead.
Name:
Anonymous
2009-01-21 23:59
Name:
Anonymous
2009-01-22 0:04
>>17
I wrote mine using butterflies.
[1]
_______________________________
[1]Munroe, Randall. "Real Programmers." XKCD. 1 Feb. 2008. 21 Jan. 2009 <http://xkcd.com/378/>;.
Name:
Anonymous
2009-01-22 3:08
>>18
DO NOT LISTEN TO THIS MAN, YOU ARE DOING IT ALL CORRECTLY, ITS JUST CYGWIN SUCKS. GET OSx86 AND HAVE A PLEASANT DAY.
Name:
Anonymous
2009-01-22 5:48
I would've helped OP as I am an EXPERT C PROGRAMMER, but unfortunately he was a namefag
Name:
Anonymous
2009-01-22 7:52
Name:
Anonymous
2009-01-22 11:13
>>20
XKCD is shit.
[1]
_______________________________
[code][1]"Is xkcd shitty today?" 22 Jan. 2009 <
http://isxkcdshittytoday.com>;;.
Name:
Anonymous
2009-01-22 11:14
XKCD is so shit, it turned me into a miserable
BBCODE FAILURE[>>24]
Name:
Anonymous
2009-01-22 12:43
>>24
Your
BBCode "skills" are
shit[1]
________________________
[1] Anonymous. ">>24." /prog/. 22 Jan. 2009. 22 Jan. 2009. <http://dis.4chan.org/read/prog/1232417627/24>;.
Name:
2010-10-22 3:41