Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Some beginner C++ questions.


  • Please log in to reply

#16
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 875 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
  • 875 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
  • 875 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
  • 875 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
  • 875 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
  • 875 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
  • 875 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
  • 875 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
  • 875 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