issue with programming in c

Asked by mouli

Hi, I am new to ubuntu. Earlier i was programming on windows operating system but now after shifting to ubuntu i am not able to write c programs as i have been doing on windows.I am able to compile and execute simple c programs but i am not aware of the changes we need to make while programming in ubuntu

for ex:
on windows void man() works fine

on ubuntu when i tried the same there was an error

similarly iam not familiar with the remaining changes we need to make to program well. So can anybody help me to solve this issue please. If there is any special document to program in ubuntu that would be helpful.

Thanks in advance

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu build-essential Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

Revision history for this message
Gord Allott (gordallott) said :
#1

first of all, make sure you have done 'sudo apt-get install build-essential'
coding in C should be the same as coding in C anywhere else apart from we don't use the silly windows stuff (no HWND_FJFSJ or whatever) but apart from that its the same as everywhere else. the following should compile and run just fine (do gcc filename.c then ./a.out, replace filename.c with whatever filename you give the source file):

#include "stdio.h"

void main() {
    printf("hello world");
}

Revision history for this message
mouli (ursmouli) said :
#2

Thanks Allot for your confirmation that we can run c in ubuntu as we do in any other platform. The mistake i made was that i did not execute that program once i saw warning that int should be return type.Thanks for your help

Revision history for this message
mouli (ursmouli) said :
#3

how can we include other packages from library when i tried to include conio.h it showed an error can anyone suggest me how to go about this?

Revision history for this message
Ahmad Tarek (ahmadtarek) said :
#4

As I know conio.h is a Windows only file.. you can't include it in Linux or general C programming.

Can you help with this problem?

Provide an answer of your own, or ask mouli for more information if necessary.

To post a message you must log in.