LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problems with lilo.conf and compiling c programs (http://www.linuxquestions.org/questions/linux-newbie-8/problems-with-lilo-conf-and-compiling-c-programs-111529/)

javadi82 11-02-2003 01:22 PM

problems with lilo.conf and compiling c programs
 
Distrubtion :Mandrake 8.1

First question:
I have edited my lilo.conf so that Linux boots after 10 seconds. Yet, Linux does not boot automatically after 10 seconds and I have to type in linux to boot it.

Compiling C programs:
Wrote a Hello World "C" program and tried compiling it with:
gcc hello.c
Then typed in a.out. But I just cannot see any output. Do I have to set any variables to see the output.

Here's the C program:

#include <stdio.h>
int main(){
printf("Hello World");
}

Thanks

musrum 11-02-2003 01:43 PM

1. lilo - you probably have a prompt line but no timeout line in your /etc/lilo.conf file. Add a line at the top of the file:

timeout = nnn

Where nnn is the number of 10ths of a second lilo should wait for automatically booting, i.e.

timeout = 300

would wait for 30 seconds. The other option is to remove the prompt line.

As for the C program. If your PATH environment variable does not contain the current directory or ., then programs in your current directory won't be found. Try './a.out' instead, or add . to your path, as in:

export PATH=.:$PATH

michaelk 11-02-2003 02:05 PM

Do you have a default line in your lilo.conf?

default=linux

Are there any errors when you attempt to execute the program, like command not found? I assume it compiles without errors?

Mara 11-02-2003 03:16 PM

Code:

printf("Hello World\n");
Try to modify the line this way. Without \n, the text goes to the buffer, \n forces it to be printed. Program exit should do the same, but different things happen...

The command to run the program after you compile it is
./a.out


All times are GMT -5. The time now is 01:28 AM.