473,385 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

conio.h (linking?) problem

I am trying to use the library conio2 and though I have managed with a
few relatively simple examples when i try to compile a program which
conio's function clrscr is not in main() i get an error from the linker.

[Linker error] undefined reference to `clrscr'
ld returned 1 exit status

I include the conio2.h on top of the file where clrscr() fn is.

How do I pass the -lconio parameter when I have multiple files?Isn't it:
gcc -lconio main.c clr_file.c file1.c file2.c ....

Is there a different way?The same thing worked when the whole program
was in one file.
Nov 15 '05 #1
17 6952
In article <e5***************************@news1.tudelft.nl> ,
Mitas Nikos <mi******@yahoo.gr> wrote:
I am trying to use the library conio2


Please post a link to standard-compliant code for the library conio2,
as the library is not specified by the C standard. We only deal with
standard C in comp.lang.c .
--
"Never install telephone wiring during a lightning storm." -- Linksys
Nov 15 '05 #2
Mitas Nikos wrote on 17/09/05 :
I am trying to use the library conio2 and though I have managed with a few
relatively simple examples when i try to compile a program which conio's
function clrscr is not in main() i get an error from the linker.
Non-standard functions headers and library.

[Linker error] undefined reference to `clrscr'
ld returned 1 exit status

I include the conio2.h on top of the file where clrscr() fn is.

How do I pass the -lconio parameter when I have multiple files?Isn't it:
gcc -lconio main.c clr_file.c file1.c file2.c ....

Is there a different way?The same thing worked when the whole program was in
one file.


<OT>
You must add the missing library (something like -lconio) to the
project.
</>

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"It's specified. But anyone who writes code like that should be
transmogrified into earthworms and fed to ducks." -- Chris Dollin CLC
Nov 15 '05 #3
Walter Roberson wrote:
In article <e5***************************@news1.tudelft.nl> ,
Mitas Nikos <mi******@yahoo.gr> wrote:
I am trying to use the library conio2


Please post a link to standard-compliant code for the library conio2,
as the library is not specified by the C standard. We only deal with
standard C in comp.lang.c .


Sorry, here is the link to http://conio.sourceforge.net/docs/html/conio2_8h.html.
Nov 15 '05 #4
Mitas Nikos wrote:
I am trying to use the library conio2
As others have totally failed to inform you about, conio2 is not part of
standard C, so is partially off-topic here. There is no portable, standard
replacement though, so it's use is not totally bogus.
and though I have managed with a
few relatively simple examples when i try to compile a program which
conio's function clrscr is not in main() i get an error from the linker.

[Linker error] undefined reference to `clrscr'
ld returned 1 exit status

I include the conio2.h on top of the file where clrscr() fn is.
OK, this header contains the declarations of the conio library. A
declaration only means 'hey compiler, there is a function foo that takes
these arguments and returns a bar'. You still need the function itself to
complete your program.
How do I pass the -lconio parameter when I have multiple files?Isn't it:
gcc -lconio main.c clr_file.c file1.c file2.c ....


Almost. Let me say here too that the use of particular compilers is not
really something discussed here, there are more specific groups for that.
However, in your case, there is a systematic error: you need to put the
library after the program-files that depend on it. Yes, it's appalling,
but the order matters here.

Uli

Nov 15 '05 #5
Ulrich Eckhardt wrote on 17/09/05 :
Mitas Nikos wrote:
I am trying to use the library conio2


As others have totally failed to inform you about, conio2 is not part of
standard C,


What are the words you don't understand in

"Non-standard functions headers and library."
--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"Mal nommer les choses c'est ajouter du malheur au
monde." -- Albert Camus.
Nov 15 '05 #6
Emmanuel Delahaye wrote:
Ulrich Eckhardt wrote on 17/09/05 :
Mitas Nikos wrote:
I am trying to use the library conio2


As others have totally failed to inform you about, conio2 is not part of
standard C,


What are the words you don't understand in

"Non-standard functions headers and library."


I personally? None, apart from the typo. However, I believe you fail to
understand that one has to have much deeper knowledge about what can or
could be standard than what can be expected from someone asking such an
obvious beginner's question. It's not about the raw information, it's the
fact that it is useless to a beginner when just thrown at them without the
simplest bit of explanation.

Uli

Nov 15 '05 #7
In article <3p************@uni-berlin.de>,
Ulrich Eckhardt <do******@knuut.de> wrote:
:As others have totally failed to inform you about, conio2 is not part of
:standard C, so is partially off-topic here.

It seems to me that I wrote,

"Please post a link to standard-compliant code for the library conio2,
as the library is not specified by the C standard."

?

Do you perceive a substative difference between
"not specified by the C standard" and
"not part of standard C" ?
conio2 is not part of C89 or C99; and since names get reused and
we didn't know which one the OP meant, there was the -possibility-
that the library being referred to had a compliant implementation.
Alas, it turned out to be not only Windows-specific but C++ code.
--
The rule of thumb for speed is:

1. If it doesn't work then speed doesn't matter. -- Christian Bau
Nov 15 '05 #8
Mitas Nikos <mi******@yahoo.gr> wrote:
Sorry, here is the link to http://conio.sourceforge.net/docs/html/conio2_8h.html.


You missed the point of Walter's post: This newsgroup deals with
standard C only; conio is not standard. Therefore you should ask your
question in another newsgroup.

http://www.ungerhu.com/jxh/clc.welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 15 '05 #9
Christopher Benson-Manica <at***@nospam.cyberspace.org> writes:
Mitas Nikos <mi******@yahoo.gr> wrote:
Sorry, here is the link to
http://conio.sourceforge.net/docs/html/conio2_8h.html.


You missed the point of Walter's post: This newsgroup deals with
standard C only; conio is not standard. Therefore you should ask your
question in another newsgroup.


I agree, but IMHO Walter didn't make the point very clearly. We can't
all be expected to know the names of all the platform-specific
libraries, but we've all seen enough off-topic posts to make a
reasonable guess that something called "conio" is probably
Windows-specific (or that a function called "fork" is probably
Unix-specific). Walter's request for "standard-compliant code for the
library conio2" sounded like someone pretending to know nothing beyond
standard C, rather than someone actually trying to be helpful. The
very fact that the OP posted his question here implies that he's
unlikely to get the joke.

We need to discourage off-topic discussion, but there's nothing wrong
with helpfully suggesting where a question might be topical.

Walter, I'm only guessing what you had in mind with your response; I
apologize if I guessed wrong.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #10
In article <ln************@nuthaus.mib.org>,
Keith Thompson <ks***@mib.org> wrote:
We can't
all be expected to know the names of all the platform-specific
libraries, but we've all seen enough off-topic posts to make a
reasonable guess that something called "conio" is probably
Windows-specific (or that a function called "fork" is probably
Unix-specific). Walter's request for "standard-compliant code for the
library conio2" sounded like someone pretending to know nothing beyond
standard C, rather than someone actually trying to be helpful.


The OP showed a gcc command line, so I didn't want to presume that
it was Windows. Might have been a Linux compatability library,
or something for Lindow,s or something providing a Windows-like
interface to make it easier for people to ease into the hard
drugs such as terminfo...

The reference to clrscn did make it fairly likely that
-something- non-standard was being discussed, but there wasn't
enough unambigous context to determine what.
--
"No one has the right to destroy another person's belief by
demanding empirical evidence." -- Ann Landers
Nov 15 '05 #11

"Ulrich Eckhardt" <do******@knuut.de> wrote

As others have totally failed to inform you about, conio2 is not part of
standard C, so is partially off-topic here. There is no portable, standard
replacement though, so it's use is not totally bogus.
C is designed so that platform-specific libraries can be shipped with the
compiler, or by third parties. There's absolutely nothing wrong with using
such libraries, as long as you don't expect your code to port to all
platforms.

What we cannot do is give advice on the details of every third party library
itself, or otherwise the group would become unmanageable in scope, since
there are so many.
Nov 15 '05 #12
Malcolm wrote:
What we cannot do is give advice on the details of every third party
library itself, or otherwise the group would become unmanageable in
scope, since there are so many.


I'm aware of that and I wouldn't want discussions about the use of every
third-party library to happen here. However, two points about the OPs
post:

1. He didn't have a problem which was specific to the use of a third-party
library but rather a general linking problem. Yes, I'm aware that the C
standard doesn't define anything like a linker, but since it is a thing
that comes up in every compiled C implementation (which is the majority)
general advise about linking is on-topic here.

2. He obviously is a beginner in C, so telling him that his request is
off-topic doesn't help. In fact it often requires some knowledge to say
where the problem exactly lies and then to judge whether here is the right
place to ask for help. Just telling a beginner to buzz off and not even a
reason in beginner-understandable language is plain rude.

Lastly, I admit that my language was cynic but I think it is deserved due
to people being intentionally rude and non-helpful.

Uli

Nov 15 '05 #13
Ulrich Eckhardt wrote:
I'm aware of that and I wouldn't want discussions about the use of every
third-party library to happen here. However, two points about the OPs
post:

1. He didn't have a problem which was specific to the use of a third-party
library but rather a general linking problem. Yes, I'm aware that the C
standard doesn't define anything like a linker, but since it is a thing
that comes up in every compiled C implementation (which is the majority)
general advise about linking is on-topic here.

2. He obviously is a beginner in C, so telling him that his request is
off-topic doesn't help. In fact it often requires some knowledge to say
where the problem exactly lies and then to judge whether here is the right
place to ask for help. Just telling a beginner to buzz off and not even a
reason in beginner-understandable language is plain rude.

Lastly, I admit that my language was cynic but I think it is deserved due
to people being intentionally rude and non-helpful.

Uli


Finally I have solved the problem that was the order of the parameter -lconio.h passed on to the
linker(and the fact that my IDE had a bug and could not switch profiles for linking).Thank you for
your help,and sorry for the fuss I have created.And yes the problem was not from the third party
library(conio.h and conio2.h work perfectly well).

I agree on the policy of not solving off topic problems(questions) but the least you can do is
redirect the inquirer to another newsgroup.Thanks again
Nov 15 '05 #14
Mitas Nikos wrote on 18/09/05 :
Finally I have solved the problem that was the order of the parameter
-lconio.h


<OT>
No. You meant "-lconio"
</>
--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

..sig under repair
Nov 15 '05 #15
On Sat, 17 Sep 2005 18:37:45 +0200, in comp.lang.c , Mitas Nikos
<mi******@yahoo.gr> wrote:
I am trying to use the library conio2 and though I have managed with a
few relatively simple examples when i try to compile a program which
conio's function clrscr is not in main() i get an error from the linker.
This is a FAQ.
How do I pass the -lconio parameter when I have multiple files?Isn't it:
gcc -lconio main.c clr_file.c file1.c file2.c ....
and this is a question about the gcc compiler, not about C itself.
Is there a different way?The same thing worked when the whole program
was in one file.


RTFM?
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 15 '05 #16
Emmanuel Delahaye wrote:
Mitas Nikos wrote on 18/09/05 :
Finally I have solved the problem that was the order of the parameter
-lconio.h


<OT>
No. You meant "-lconio"
</>


Again I'm sorry i meant "-lconio".
End of problem.
Nov 15 '05 #17
Christopher Benson-Manica wrote:
Mitas Nikos <mi******@yahoo.gr> wrote:
Sorry, here is the link to http://conio.sourceforge.net/docs/html/conio2_8h.html.


You missed the point of Walter's post: This newsgroup deals with
standard C only; conio is not standard. Therefore you should ask your
question in another newsgroup.


The essential issue of topicality isn't that conio isn't a standard
library or isn't written in Standard C, but rather that the
implementation must be told how to link object libraries, and that is
platform specific. What conio functions do or what it is written in is
irrelevant when linking object modules.

Thad

Nov 15 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Wolfgang | last post by:
I have a problem with linking my CPP Code under a irix6 machine (sgi, UNIX). In my CPP code I use some Functions which are written in Python. So its a kind of CPP wrapper for my Python functions In...
0
by: gasturbtec | last post by:
please help im new at access programming and i just got this project dropped in my lap because the old programmer quit. i've been doing ok so far but now i need to add code to an existing database...
18
by: Mark P | last post by:
I have a bit of vb code that uses Tables.Append to programatically link tables from Oracle and DB2 datasources. The problem I am having on some client machines is that the link will take anywhere...
4
by: Eduardo Elias Camponez | last post by:
Is conio.h C library or just C++? Tks Eduardo Camponez
1
by: buchalino | last post by:
Hi Guys, Please can someone help me, I am having a linking problem . I am writing a socket program, the problem is just the linking . I am using VC++ In the process of the problem, I...
17
by: annai | last post by:
hi i want 2 know wat s the special for using conio.h
13
by: 7stud | last post by:
test1.py: -------------------- import shelve s = shelve.open("/Users/me/2testing/dir1/aaa.txt") s = "red" s.close() --------output:------ $ python test1.py
0
by: xieml2007 | last post by:
Dear Madam or Sir, I encountered one problem which is quite similiar to the discussions launched at the web site: http://www.thescripts.com/forum/thread280324.html
2
by: amitppawar2007 | last post by:
#include <stdio.h> #include <conio.h> int main(void) { unsigned port = 0; int value; value = outp(port, 'C'); printf("Value %c sent to port number %d\n", value, port); return 0; }
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.