help on C programming. using Linux gcc???

help on C programming. using Linux gcc???

Post by Michael Falcone » Sun, 12 Apr 1998 04:00:00



Hello All,
I have Redhat Linux 5.4 up and running fine and I am using gcc v
2.7.3.1 I think it is. I am doing a Open University course in my
spare time, which involves learning the C programming language under
MSDOS. So I thought this was the time to use the Linux programming
resources that I have, and program under Linux. However, I am having
great difficulty compiling and running even the most simple msdos C
programs under Linux! I am using a ANSI C compiler under MSDOS and it
compiles, links and executes all the programs really easy, without
having to have the use of any include libraries, which come with the
msdos compiler.
      When I do attempt to compile under gcc I keep error messages,
saying that the reserved C words are not recognised. So the program
will not compile, let alone link, and let alone run! Any help would
be greatly appreciated.

--
 I counsel thee to buy of me gold tried in the fire, that thou mayest
be rich; and white raiment, that thou mayest be clothed, and that the
shame of thy *ness do not appear: and annoint thine with

 
 
 

help on C programming. using Linux gcc???

Post by Paul Flinder » Thu, 16 Apr 1998 04:00:00



> Hello All,
> I have Redhat Linux 5.4 up and running fine and I am using gcc v
> 2.7.3.1 I think it is. I am doing a Open University course in my
> spare time, which involves learning the C programming language under
> MSDOS.

It's nice to know that the OU are teaching their students the leading
edge technologies. :-)

Quote:> So I thought this was the time to use the Linux programming
> resources that I have, and program under Linux. However, I am having
> great difficulty compiling and running even the most simple msdos C
> programs under Linux! I am using a ANSI C compiler under MSDOS and it
> compiles, links and executes all the programs really easy, without
> having to have the use of any include libraries, which come with the
> msdos compiler.
>       When I do attempt to compile under gcc I keep error messages,
> saying that the reserved C words are not recognised. So the program
> will not compile, let alone link, and let alone run! Any help would
> be greatly appreciated.

Without some example code and the error messages that gcc gives when
you try to compile that code it's impossible to give you specific
advice.

However two possibilities do come to mind
  a) you have a dual boot system and you have ended up with an upper
     case file name which will be interperted as C++, not C source
     (because it ends in .C rather than .c - these things matter to
     Unix systems).

  b) You have just learnt that C isn't actually terribly portable
     and gcc has got upset with DOS specific constructs

Post a (small) code snippet and people may be able to help.

--
Paul

 
 
 

help on C programming. using Linux gcc???

Post by Kaz Kylhe » Thu, 16 Apr 1998 04:00:00




Quote:>Hello All,
>I have Redhat Linux 5.4 up and running fine and I am using gcc v
>2.7.3.1 I think it is. I am doing a Open University course in my
>spare time, which involves learning the C programming language under
>MSDOS. So I thought this was the time to use the Linux programming
>resources that I have, and program under Linux. However, I am having
>great difficulty compiling and running even the most simple msdos C
>programs under Linux! I am using a ANSI C compiler under MSDOS and it
>compiles, links and executes all the programs really easy, without
>having to have the use of any include libraries, which come with the
>msdos compiler.

You  may be using an ANSI C compiler under MS-DOS, but you are probably
writing programs that use MS-DOS extensions.

Do your programs include headers like <dos.h>, <io.h> or <conio.h>?

Do you call functions like getch() or cprintf()?

None of these features are part of ANSI C.

 
 
 

help on C programming. using Linux gcc???

Post by Kaz Kylhe » Thu, 16 Apr 1998 04:00:00





>> Hello All,
>> I have Redhat Linux 5.4 up and running fine and I am using gcc v
>> 2.7.3.1 I think it is. I am doing a Open University course in my
>> spare time, which involves learning the C programming language under
>> MSDOS.

>It's nice to know that the OU are teaching their students the leading
>edge technologies. :-)

For a bunch of newbies, it doesn't really matter. You can learn C adequately
under MSDOS, then upgrade to a decent operating system later.

What rubs me the wrong way is that they are learning obsolete MS-DOS
extensions that won't compile elsewhere.

What an utter waste of time.

But hey, what else is an unemployed DOS programmer gonna do? Teaching his
obsolete skills to a new breed of disciples could be a good way of
refurbishing a deflated ego. :)

 
 
 

1. getchar with gcc using pointers --using gcc not any other compiler

I need to make a same program to the below to getname and display it
and display certain character (certain element) .

#include <stdio.h>
/*
lesson01_creating_arrays_using_pointers.c */

main ()
{
float array_elements[50];
int no_array_elements;
int array_element_no;
input_array_elements(&no_array_elements,array_elements);
processing(no_array_elements,array_elements);
display_table(&array_element_no,array_elements);

input_array_elements(no_array_e,array_e)
//------------------------------------------------------
float *array_e;
int *no_array_e;
{
char another_element;
do {
printf ("Enter an array element :  ");
scanf("%f",&array_e[(*no_array_e)]);
printf ("More array_elements (y/n)  :  ");
scanf("\n");
scanf("%c",&another_element);
(*no_array_e)++;

processing(no_array_e,array_e)
//------------------------------------------------------
int no_array_e;
float *array_e;
{
float total=0;
int i=0;
do {
printf ("The array element no %d = %f\n",i,array_e[i]);
total=total+array_e[i];
i++;
printf ("\nThe average = %f\n",(float) total/no_array_e);

display_item(array_element_n,array_e)
//------------------------------------------------------
int *array_element_n;
float *array_e;
{
printf ("Enter an array element :  ");
scanf("%d",array_element_n);
printf ("\nThe array element is : %f \n",array_e[*array_element_n]);

2. memtest86 and Athlon 700

3. running a program compiled using gcc under RH5?

4. html in kfm - no images

5. Problems compiling a simple program using templates with GCC

6. Sendmail Help needed

7. AIX Program sizes using egcs/gcc

8. 2.5.39 won't boot, UP

9. generating c code from c++ programs using gcc

10. Programming a file server for linux using TCP/IP - Need help urgently

11. programming program or shell for gcc ?

12. Help C program in linux help help help !!!!!!!

13. RH6.0 - i386-glibc20-linux-gcc or i386-redhat-linux-gcc