Welcome, Guest. Please login or register.

Author Topic: Help with C? I have a simple(?) problem.  (Read 5230 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline redrumloaTopic starter

  • Original Omega User
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 10126
    • Show only replies by redrumloa
Help with C? I have a simple(?) problem.
« on: February 24, 2008, 12:05:06 AM »
Please see this thread.

I am using 'Super C' for the Commodore 128, it is a standard c based on K&R so I figure one of you Amiga guys could help :-?
Someone has to state the obvious and that someone is me!
 

Offline Vairn

  • Newbie
  • *
  • Join Date: Jan 2008
  • Posts: 26
    • Show only replies by Vairn
Re: Help with C? I have a simple(?) problem.
« Reply #1 on: February 24, 2008, 12:33:56 AM »
hmm,
You could try using printf, not print.

But since I have never used "Super C", I could be wrong, but most C compilers use printf.


Basically the linking error is it saying that it doesn't know of any methods that has the name "print".

Ie, no external definition, is it saying there is no difinition of "print" in the headers you linked with.



 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Help with C? I have a simple(?) problem.
« Reply #2 on: February 24, 2008, 12:48:25 AM »
stdio has no "print" function.

Also, getchar() works different ways on different systems, if you use it to "pause until user hits a key" that is.
 

Offline weirdami

  • Hero Member
  • *****
  • Join Date: Jan 2003
  • Posts: 3776
    • Show only replies by weirdami
    • Http://Bindingpolymer.com
Re: Help with C? I have a simple(?) problem.
« Reply #3 on: February 24, 2008, 01:01:10 AM »
What you are going to have to do is to write a separate print function that uses printf to print that stuff and compile it together with the program. Then, you'll need some pointers and I think a graphing calculator.  ;-)
----
Binding Polymer: Keeping you together since 1892.
 

Offline redrumloaTopic starter

  • Original Omega User
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 10126
    • Show only replies by redrumloa
Re: Help with C? I have a simple(?) problem.
« Reply #4 on: February 24, 2008, 01:19:19 AM »
Thanks for the responses, I'll try that now. I suspect you are probably right, I thought maybe that was it but I am green enough I trusted the manual. Look at the manual page, that's what it showed. However I am only in the first chapter and have already found 2 typos on my own! This will make 3 typos in just the 1st chapter so far!

I'll report back in a minute or so.
Someone has to state the obvious and that someone is me!
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Help with C? I have a simple(?) problem.
« Reply #5 on: February 24, 2008, 01:20:57 AM »
I'd suggest moving that manual to trash.

2nd edition of K&R would be much more useful.
 

Offline redrumloaTopic starter

  • Original Omega User
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 10126
    • Show only replies by redrumloa
Re: Help with C? I have a simple(?) problem.
« Reply #6 on: February 24, 2008, 01:27:18 AM »
Yup that did it, confirms another F-up in the manual. I may give up on this Super C manual now and just read a generic gcc book I have... :-x

Thanks for the info.
Someone has to state the obvious and that someone is me!
 

Offline redrumloaTopic starter

  • Original Omega User
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 10126
    • Show only replies by redrumloa
Re: Help with C? I have a simple(?) problem.
« Reply #7 on: February 24, 2008, 01:37:20 AM »
Quote

Piru wrote:
I'd suggest moving that manual to trash.

2nd edition of K&R would be much more useful.


Yeah, I am thinking that would be a good idea. I haven't found this manual to be all that easy to read so far and errors like this make it near impossible to learn. I have THIS book on hand which I will try next. I may get the actual K&R book too if people like you think it would be beneficial.
Someone has to state the obvious and that someone is me!
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Help with C? I have a simple(?) problem.
« Reply #8 on: February 24, 2008, 01:49:52 AM »
It's a bit hard for me to judge if it would be beneficial. Learning to program is harder for some, and different learning methods work better for some people than others. If I remember it correctly my very first C tinkering happened without much programming manuals at all (I had some autodocs and examples from RKRM IIRC which I played with).

K&R, however, is the very "C bible" if anything is.
 

Offline tiffers

Re: Help with C? I have a simple(?) problem.
« Reply #9 on: February 24, 2008, 02:29:52 AM »
@redrumloa

This is another really decent book. I recently bought it to re-learn C so I could start programming on the Amiga. It's very accurate and very clear.

tiffers
Amiga FTW!
 

Offline Trev

  • Hero Member
  • *****
  • Join Date: May 2003
  • Posts: 1550
  • Country: 00
    • Show only replies by Trev
Re: Help with C? I have a simple(?) problem.
« Reply #10 on: February 24, 2008, 04:54:52 AM »
One of the nice things about the K&R book is the description of the standard library. C language principles are built upon by creating basic implementations of many of the standard library functions, which provides a bit of insight into how and why a standard library exists. There are also simple examples of many basic data structures and algorithms and an appendix that includes the first ANSI standard.
 

Offline buzz

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 612
    • Show only replies by buzz
Re: Help with C? I have a simple(?) problem.
« Reply #11 on: February 24, 2008, 08:46:18 AM »
Quote

2nd edition of K&R would be much more useful.


I hardly think the manual is easy for a new programmer. It might be the be all and end all of C references/manuals, but it can be complicated for the beginner.

It's also expensive ;-) I recommend this book, but I think you may well find a better one to "learn from" initially.
 

Offline SamuraiCrow

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2281
  • Country: us
  • Gender: Male
    • Show only replies by SamuraiCrow
Re: Help with C? I have a simple(?) problem.
« Reply #12 on: February 24, 2008, 08:44:27 PM »
C on the C64/128 is a waste of time.  If you want results, you end up having to rewrite code in Assembly langauge anyway.  :-(
 

Offline redrumloaTopic starter

  • Original Omega User
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 10126
    • Show only replies by redrumloa
Re: Help with C? I have a simple(?) problem.
« Reply #13 on: February 25, 2008, 12:12:54 AM »
Quote

SamuraiCrow wrote:
C on the C64/128 is a waste of time.  If you want results, you end up having to rewrite code in Assembly langauge anyway.  :-(


Waste of time, why? Look at my sig. 16bit 20Mhz CPU, 16MB RAM directly addressable to the CPU. Plenty of horsepower untapped, plenty of open source tools that could be ported.

Also what I learn can be used elsewhere. I am currently learning using gcc on Ubuntu.
Someone has to state the obvious and that someone is me!
 

Offline FluffyMcDeath

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 3440
    • Show only replies by FluffyMcDeath
Re: Help with C? I have a simple(?) problem.
« Reply #14 on: February 25, 2008, 12:34:19 AM »
Quote

SamuraiCrow wrote:
C on the C64/128 is a waste of time.  If you want results, you end up having to rewrite code in Assembly langauge anyway.  :-(


What a strange comment. If by "results" you mean hand optimized assembly code, then yes. If, on the other hand, you mean something more along the lines of port pre-existing blocks of codes and routines already written in C to your chosen platform then we end up with a very different metric to judge C by.

C is a very good compromise between small relatively quick code and human read/write-ibility for small platforms.