iDevGames Forums
<conio.h> No such file or directory? - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Programming Languages & Scripting (/forum-8.html)
+--- Thread: <conio.h> No such file or directory? (/thread-4033.html)

Pages: 1 2


<conio.h> No such file or directory? - Achithyn - Aug 2, 2006 06:46 PM

Greetings all,
I was thinking of writing a little password program for my text rpg. As I was reading through my programming book, I came across getch() and getche(). getch() would be a great way for me to accept input from the user and print to the screen asterisks. However, when I try to include the required header: <conio.h> I get an error message that states: No such file or directory.

How do I include header files that are not from the standard library? Thanks for your help. Smile

~Achi


&lt;conio.h&gt; No such file or directory? - OneSadCookie - Aug 2, 2006 07:14 PM

I think you'll find that those functions don't exist on Mac OS X -- they're Windows-specific. Termios seems to be the usual way to do this. See eg. http://curl.haxx.se/lxr/source/src/getpass.c for an example.


&lt;conio.h&gt; No such file or directory? - Achithyn - Aug 2, 2006 08:43 PM

Thanks for the update, OSC. Smile That really is no fun, though. Sad I didn't know there were unsupported libraries. Well, I do now. Smile So, is there a way to know whether or not a header is supported on your select OS?

Termios.h looks interesting. Honestly, it confuses me... information overload? getch() was easy to remember and implement. Perhaps I'll just keep reading this book I have, keep playing with code, and eventually some of what was in that example will make sense. Smile Thanks for your help. Grin

~Achi


&lt;conio.h&gt; No such file or directory? - Cochrane - Aug 3, 2006 12:48 AM

Easiest way to know if a header is supported is checking for whether it is present. Spotlight is a nice tool for this. It is not a perfect test, though (for example, conio.h is present if one installed darwine, but still not something that is a good idea to use for general purpose programming).


&lt;conio.h&gt; No such file or directory? - OneSadCookie - Aug 3, 2006 12:58 AM

"Supported" is such a tricky word...

Headers are always supported, they're just text files Wink The question is whether the functionality the header declares is supported. If the header's present on your Mac without any third-party software, that's a pretty good sign. Check in /usr/include and /System/Library/Frameworks, using find <dir> -name '*.h' | grep <header>

Of course, just because something's not there, doesn't mean it's not available. Then you head for Google.


&lt;conio.h&gt; No such file or directory? - Hog - Aug 3, 2006 03:35 AM

I'd suggest using curses. It just about provides all functionality you are going to need sooner or later when doing a terminal based game.


&lt;conio.h&gt; No such file or directory? - Achithyn - Aug 3, 2006 07:27 PM

Hog Wrote:I'd suggest using curses. It just about provides all functionality you are going to need sooner or later when doing a terminal based game.
Of what I have seen of curses, it looks like it will do the trick. Smile And, when I spotlight it, I am able to find it on my Mac. Smile So... what the problem? Well, I copied an example program that uses curses... and I get this error message:

ZeroLink: unknown symbol '_stdscr'

Is this just another thing that is not supported... or is it just something I am doing wrong? Thanks for your help.

OSC & Cochrane - thanks for the information. Smile

~Achi


&lt;conio.h&gt; No such file or directory? - OneSadCookie - Aug 3, 2006 07:35 PM

You're going to need to link to the curses library. Probably -lcurses something like that, but I'm not at a Mac right now...


&lt;conio.h&gt; No such file or directory? - Achithyn - Aug 24, 2006 05:00 PM

OneSadCookie Wrote:You're going to need to link to the curses library. Probably -lcurses something like that, but I'm not at a Mac right now...
I know this may sound stupid, though I don't know how to include an external library with my xcode project. I've been reading around quite a bit and am unsure if I am reading down the right path. Care to point me towards the right tutorial? Thanks!

~Achi

PS - sorry for the late replay. ><


&lt;conio.h&gt; No such file or directory? - OneSadCookie - Aug 24, 2006 05:15 PM

Use the "Add files" command from the Project menu, I think. You can use "go to folder" (command-shift-g) in the open dialog to go to invisible places -- in this case /usr/lib. Look for a file called libcurses.dylib or something similar (again, not at a Mac).


&lt;conio.h&gt; No such file or directory? - Achithyn - Aug 24, 2006 07:32 PM

I tried to use 'Add files' though it wasn't there. >< The only equivalent was "Add to project" though it was grayed out. Anyway, your post helped me word my search phrase in the xcode help... it seems you can just drag and drop the libraries in the source folder and xcode does the rest. Well, that's good to know! >< lol. It's time to start playing with curses! Grin Thanks for your help. Smile

~Achithyn


&lt;conio.h&gt; No such file or directory? - OneSadCookie - Aug 24, 2006 07:46 PM

"Add to Project" is the right one. I think you have to have something selected in the groups & files pane to get it un-grayed.


&lt;conio.h&gt; No such file or directory? - Achithyn - Aug 24, 2006 08:30 PM

Yeah, I started playing around with adding files to a test project and have figured out a few ways of doing it. My problem right now is, adding the libncurses.dylib or libcurses.dylib, doesn't seem to make a difference. I still get the same error: ZeroLink: unknown symbol '_stdscr'. Taking up your suggestion with adding -lcurses to the build settings also didn't change the error message. Sad

I'm not sure if I am adding the right file or where I am suppose to add it. I moved the dylib file around into different project folders: sources, products, etc. no changes. I'm not sure if it matters, though when I drag the libcurses.dylib to my project, I am dragging a shortcut of the actual file. The actual file is called: libncurses.5.4.dylib. I've also opened the curses.h file in my project and added it, though it didn't do anything either.

I'm still reading around, trying to figure out what I need to do, though just like before, I am just poking around in the dark. Anyone have a lighter... better yet, a flashlight would do wonders. Grin

Thank you for your help and time! Smile

~Achi


&lt;conio.h&gt; No such file or directory? - Hog - Aug 25, 2006 03:40 AM

You don't need to add any libs as i recall. You only need to add -lcurses to the "Other Linker Flags" in the project or target settings.


&lt;conio.h&gt; No such file or directory? - OneSadCookie - Aug 25, 2006 04:05 AM

should be -lncurses, given the name quoted above