Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Some beginner C++ questions.


  • Please log in to reply

#16
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
I can't say about linux. I would expect it to work. of course, however, you'd think it would work on a mac. I just configured my first linux pc last week while in your neck of the woods - Boulder. Lovely place. CU campus is fantastic. back to linux - I haven't used it much and would be very disappointed if it does not work.

idea: can you get a copy of conio.h from another platform? if you get one and it won't compile - try deleting the functions you don't need.

no luck with the search, yet.
  • 0

Advertisements


#17
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
it looks like linux may have the same shortcoming with conio.h. I found a site with a linux download.

see AAIO at
http://www.e.kth.se/...r/applications/
  • 0

#18
Fealos

Fealos

    Member

  • Topic Starter
  • Member
  • PipPip
  • 17 posts
This looks promising because when I downloaded it, the description said multi-platform header file. But, I didn't know that headers had to be compiled before you could use them. Is this true? When I downloaded the aaio.h file, it came in a folder with a whole bunch of makefiles, installers, and configure executables. It also came with some files named aaio.c, aaio1.c, and aaio2.c. What are these for? The only things that seem to be in the aaio.h file are some function prototypes, and a whole lot of commenting. This makes me assume that you have to compile them somehow with the .c files. Sorry, I haven't ever made my own headers yet. I assumed they were single text files.
  • 0

#19
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
when a .h file is included in a .c or .cpp file, it is automatically compiled with the .c or .cpp file.
if we are really lucky you can copy the aaio.h file into your source directory and go from there. let's try this:

add the following line at the top of the source file which will use kbhit() and getch(). this goes at the top of the file with the other include statements.
#include "aaio.h"

copy aaio.h to the same directory as your source code.

compile and post results.

be prepared to spend some time debugging if it won't compile. there are 2 expected issues:
1. other include statements in aaio.h which require code not used by the mac
2. unnecessary functions within aaio.h
  • 0

#20
Fealos

Fealos

    Member

  • Topic Starter
  • Member
  • PipPip
  • 17 posts
OK, so I included aaio.h and everything compiled perfectly. I added a function to test kbhit() and getch(). with those function invocations it compiled perfectly. when run, it gives me this error:

ZeroLink: unknown symbol '_kbhit'
Abort

I find it extremely surprising that it compiled with no problems on the first try.
  • 0

#21
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
it sounds like the error is in aaio.h. give me some time to look at the file and do some testing here. one experiment you could try - comment out the kbhit() code and any releated curly braces {}. recompile and rerun. this will tell us if getch() is working. the link in the previous post was for unix/linux and may not work on the mac.
happy testing
  • 0

#22
Fealos

Fealos

    Member

  • Topic Starter
  • Member
  • PipPip
  • 17 posts
You were right to tell me to try that. I'm getting the same error for getch().

Also, the guy who developed that header (aaio.h) had a bunch of OS X stuff on his site that he had also developed. I sent him an email asking him if he had run into this problem, since he obviously has while developing on Linux. I asked him if he knew whether aaio.h would work on the Mac, and if it doesn't whether he knew of another way to get kbhit() and getch(), or functions similar to them.

Hopefully he checks his mail frequently.
  • 0

#23
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
after looking at conio.h here, it looks like it is used only for declaration purposes - the actual code is elsewhere(probably assembly language). aaio.h must be similar.

good luck with the email. if he responds, you might ask if that is the only file you need on a linux system.
  • 0

#24
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
the code might be in aaio.c.

copy this file to the same directory as your source code, compile, then run.
  • 0

#25
Fealos

Fealos

    Member

  • Topic Starter
  • Member
  • PipPip
  • 17 posts
I copied aaio.h, aaio.c, aaio1.c, and aaio2.c all to the project folder. It looks like aaio.h calls aaio.c, and then that file calls either aaio1.c or aaio2.c, depending on what system you're running it on.

Edited by Fealos, 26 May 2005 - 05:33 PM.

  • 0

Advertisements


#26
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
does the previous post mean that you did this earlier and it has already failed with these files?
  • 0

#27
Fealos

Fealos

    Member

  • Topic Starter
  • Member
  • PipPip
  • 17 posts
The first time I tried to compile with aaio.h, I had added all four files.

Should I try with only aaio.h added?
  • 0

#28
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
no - you did the right thing by copying all of the files.

that tells us that the linux code won't work on a mac, sorry(wishful thinking).

hang onto those files in case you go back to linux.

please post any response from the aaio author.

final thought/sales pitch - this type of thing rarely happens in java. c++ is not portable. what works with microsoft may not work on a mac and may not work in linux. java is much more portable. end of sales pitch.

good luck
  • 0

#29
Fealos

Fealos

    Member

  • Topic Starter
  • Member
  • PipPip
  • 17 posts
Thank you so much for everything. I got way more help here than I ever would have thought I would. Plus, I've learned a lot, even if I didn't get much farther than where I started. I think I can handle just having the user hit return after input.

I'll definitely be focussing on java as soon as possible.
  • 0

#30
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
we are happy to try. keep us posted if the aaio author comes up with anything.
good luck at CSU
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP