Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-22-2002, 10:54 AM   #1
Registered: Oct 2002
Location: Michigan
Posts: 71

Rep: Reputation: 15
New to Programming

Im new to programming and linux. i'm running redhat 8.0 i have a simple intro to c class and i want to be able to make my programs under linux. i thougth this would be very easy with gcc and all but when i make a program in vi or any editor then try to compile it with gcc i get errors.

this is the program

#include <stdio.h>
#include <conio.h>

void main(void)

as you can see this is a very simple program. when i use gcc to compile it cannot find conio.h . after a while i gave up on using command prompt to do this so i installed anjuta. but when i use anjuta to compile the same program i managed to add the directory that has conio.h so it can do a compile and a compile with make successfully, but when i go to do a build i get

/usr/bin/ld: cannot find -lconsole
collect2: ld returned 1 exit status

i am not logged in as root, any help would be greatly appreciated.
Old 10-22-2002, 11:32 AM   #2
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 110Reputation: 110
The "conio.h" header file is (normally) not found on UNIX (-like) operating systems. If I recall correctly, it even is specific to Borland / Inprise ("turbo") compilers. So I'm quite surprised you did find it on your Linux-system.

If you want functionality similar to "conio.h" in Linux you'll need to learn about "ncurses". Which is quite different, more complex, and capable of more things than the conio-library.

However, the good news is, that you do not need the "#include <conio.h>" line at all in you program!

Just delete the "#include <conio.h>" line and also change "getch" to "getchar". Then compile again (with: "gcc -o myprog myprog.c" on the shell prompt).

Last edited by Hko; 10-22-2002 at 11:41 AM.
Old 12-20-2017, 12:29 PM   #3
LQ Newbie
Registered: Dec 2017
Posts: 21

Rep: Reputation: Disabled
where is there a list of functions and header files we could expect gcc to come with?
Old 12-20-2017, 01:03 PM   #4
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,770
Blog Entries: 6

Rep: Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586Reputation: 2586

You have exhibited a pattern of seeking out old posts and replying to them without providing any useful information or questions of your own.

If you have questions of your own please post them to your own thread with proper context. Please see the Site FAQ for guidance in participation on this forum.

If this pattern continues your posting privileges may be suspended.
Old 12-24-2017, 10:21 AM   #5
Registered: Apr 2015
Location: Yorkshire, England
Distribution: Linux Mint
Posts: 134

Rep: Reputation: Disabled
conio.h is a microsoft required header. You may have need for function kbhit(). I have code to replace this send me a message or reply to this if you find you need kbhit
Old 12-24-2017, 10:54 AM   #6
Registered: Apr 2015
Location: Yorkshire, England
Distribution: Linux Mint
Posts: 134

Rep: Reputation: Disabled
The difference between getch and getchar is getch waits for any character and then continues, where as getchar will wait for either EOF or enter being pressed as it reads blocks of text. Read about the linux terminal and buffering


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
which programming language is used to do tcp/ip programming?? gajaykrishnan Linux - Networking 9 12-21-2012 05:16 AM
im new to programming but..... boxerboy Programming 6 08-26-2005 06:17 AM
Difference between Top Down programming & Bottom up programming minil Programming 1 06-17-2005 02:42 AM
C programming oranj Linux - Networking 1 12-07-2004 12:40 AM
Qt Programming... jinksys Programming 1 08-06-2003 04:33 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:18 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration