[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: gcc (compiling a simple C program)



What's your first error?

I don't know what's going on on your system, but your program works fine.

My test of your test:

[apj wattsx apj]$ gcc -o test test.c
[apj wattsx apj]$ ll
-rwxrwxr-x    1 apj      apj         11369 Nov  5 22:24 test
-rw-rw-r--    1 apj      apj           107 Nov  5 22:24 test.c
[apj wattsx apj]$ ./test
By Jove, it works!

Check your compiler/include file install/path.

Usually the first error is the important one. The rest are a cascade effect of the first. Fix the first and the rest go away.

I studied K&R in 1983. It's a good place to start.

Alex

mark wrote:

On Tuesday 05 November 2002 03:22 am, you is done writ:


Just to test gcc, I tried to compile this:

***test.c***
#include <stdio.h>
int main(int argc, char *argv[]) {
  printf("By Jove, it works!\n");
  return 0;
}
*** end file ***

with this:
gcc -o test test.c

And it didn't work.

I got this:


<snip *whole* buncha errors>

Well, it worked fine...until, trying to reproduce your problem, I did something that was *wrong*.

Please go out and get a C programming book (I prefer K&R, the "bible", but that's me).

In any programming language, *everything* that you write is translated by the compiler into machine language instructions, *except* for comments.
Comments are *required* to be indicated in the syntactically-defined manner to the compiler, otherwise, it don't know it's a comment.


So, please either delete the lines with '*', or else define them to the complier *as* comments, by:
/* ***blah, blah ***** */
^beginning and ^^ end of C-style comment (note that it can continue for multiple lines, until it sees the closing */


or
// ***** blah, blah *********
^^ C++ style comment, goes to end of line.

mark










[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]