Click to See Complete Forum and Search --> : GCC/Redhat 7.3


CuriousJack
07-30-2002, 04:04 PM
I've installed Redhat 7.3 and GCC does not appear to be working.

I came to this conclusion after using gcc to compile the following program:

// test.c
#include <stdio.h>

int main(int argc, char* argv[])
{
printf("Hello World!\n");
return 0;
}

Using the commands:
>gcc test.c -o test
>test

I expected to see "Hello World!" printed in the terminal window, but this didn't happen. Can anyone tell me what I've done wrong?

Thanks for your help.
CuriousJack

fancypiper
07-30-2002, 04:32 PM
Error messages from the attempt to compile will give us some hints.

We can't answer your question because you haven't given us any clues about results, just what you tried.

I'll try mind reading again.

Uh..... where is that darn crystal ball, hmm oh-oh. I see what's wrong. You forgot to install the development packages!

See this thread (http://linuxnewbie.org/forum/showthread.php?s=&threadid=57366)

mdwatts
07-30-2002, 05:46 PM
Originally posted by fancypiper

Uh..... where is that darn crystal ball, hmm oh-oh. I see what's wrong. You forgot to install the development packages!

See this thread (http://linuxnewbie.org/forum/showthread.php?s=&threadid=57366)

Crystal ball? I lent it to you last time. Who has it now?

CuriousJack...

If the resulting 'test' is not in your path (echo $PATH), then you need to prefix the command with './' so the shell will look in the current directory.

./test

You may also need to set the execute bit first.

chmod +x test

skrappa
07-30-2002, 05:53 PM
I thought you used "g++" to compile progs like that

CuriousJack
07-30-2002, 07:59 PM
mdwatts, you're right..the executable directory was not in my path. Thank you and everyone else that replied to my question.

CuriousJack