Question:
compiling c program in ubuntu...pls help me!!?
Surachit
2011-08-13 21:28:46 UTC
hi!
i've been trying to run the gets and getch command in my c program using the GCC compiler.. but i think GCC cannot support the conio.h header file. also, i've been trying to run programs with graphics command but GCC cannot support the graphics.h header. are there ways on how to update my GCC to support the aforementioned header files (conio.h and graphics.h)?
thanks a lot.it is showing the following error message::


surachit@surachit-desktop:~/Desktop$ gcc -Wall -W -Werror hello.c -o hello
hello.c:2:18: error: conio.h: No such file or directory
cc1: warnings being treated as errors
hello.c: In function ‘main’:
hello.c:7: error: implicit declaration of function ‘getch’
Five answers:
?
2011-08-13 23:16:32 UTC
You can use getch and getchar in gcc....just include

#include

if you need graphics support in Unix then you should install Opengl package and add #include

you can run graphics program after installing glut by the following

$gcc -l glut pgm.c





for more information lookup manual page of getch and getchar and for opengl in unix visit opengl.org.
?
2016-12-09 00:36:09 UTC
C Program In Ubuntu
Just Jess
2011-08-13 21:43:41 UTC
It'll support any header file on your computer if you tell it where it is. Trouble is, conio.h is an MS-DOS file. You're trying to compile a windows program on a non-windows computer.



In the future, though, this is how you would fix that problem.



gcc -I/usr/include/header_you_want_to_include.h -Wall -Werror hello.c -o hello



If you want to learn how to program in ubuntu, just grab the source code to any package on your computer and start reading :) If you want to compile it, just type in



./configure # you only have to do this once

make



inside the source directory. Save backups, mess around with things, go nuts.
Angela D
2011-08-13 21:31:39 UTC
conio.h isn't a standard c header file. don't include it. ditto graphics.h. are you trying to compile an ms-dos c program?



start by including stdio.h
Linux Mint 11
2011-08-14 02:05:36 UTC
How to Install C and C++ Compilers in Ubuntu and testing your first C and C++ Program

http://www.ubuntugeek.com/how-to-install-c-and-c-compilers-in-ubuntu-and-testing-your-first-c-and-c-program.html





LUg.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...