 |
 |
How to use just basic C++ with project builder?
|
 |
|
 |
|
Mac Elite
Join Date: Oct 1999
Location: New York, NY
Status:
Offline
|
|
Hey,
I'm doing a C++ programming course, and while project builder is wonderful and very full of features, I can't figure out how to just write basic C++ programs with it.
I tried making a "C++ tool", but it wouldn't let me do simple things like use "void main()" instead of "int main()" and had a lot of trouble with stuff like that. I just want text output and input, I don't need any graphics. I can do this easily on my old version of Mac Codewarrior or my school's Visual C++ compiler.
I'll also need to include the Lawrenceville Press libraries which came with the book. Can this be done fairly easily?
Thanks...
~Maxintosh
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
In what way does int main cause problems instead of using void main? I'm pretty sure that main has to be int under ANSI/ISO C++ anyways.
Text I/O should work as normal.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 1999
Location: New York, NY
Status:
Offline
|
|
It refuses to accept "void main()" even though we learned it was acceptable to use that. It's just easier cause you aren't forced to return anything. That's a little detail.
The whole "cin" fiasco is terrible. I will get points off for not having my input on the same line as my output. Why doesn't cc conform to ANSI standards and not require you to flush the cout stream before cin?
I guess I'll be running CodeWarrior in Classic for now.
~Maxintosh
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
This is probably a bug in the libraries. Why don't you try posting to darwin-development@lists.apple.com and ask some of the developers about it?
And CodeWarrior 6 is carbonized and runs natively in OS X.
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Feb 2001
Location: Charleston, SC
Status:
Offline
|
|
I've been using the Terminal application to compile the code, and using BBedit or Tex-Edit (in Classic) to write it and save it. When you're in Terminal, the compiler is run the same way as a g++ compiler, except that instead of typing at the "%" prompt:
g++ -g -Wall...
you type:
c++ -g -Wall...
and it will compile it. The directory is a little weird, though. When I compiled my hello.cc program, I had to type in "/hello/hello" in order to run it (won't let me go directly into the "hello" directory I had just made-- "permission denied"). Also, the last couple of times I've compiled a program, it wouldn't make a file called what I wanted it to be called, but it would run if I ran the "a.out" file it creates when compiling.
Regrading the problem with the "int main ()": In "Practical Programming..." it lists it as the "main ()" function, leaving out the "int" or "void" altogether. It said that many compilers will type a function as "int" if it doesn't specify. But, apparently, the compiler that the Terminal uses needs a specification of type, but it may work with a "void" type, as well (I'll have to check it out).
I'm new at this, but it does work better than the "C++ tool" in PB, and it's easier to follow along in the book, because I can, for the most part, use the exact same methods and programs that are in the book, and they work.
The trick is to format the text correctly, converting it to UNIX, and getting rid of smart quotes before compiling it, and knowing what to do at a command-line prompt (which I don't have a good grasp of yet). If you're learning from a "standard" book or class, I think this is the way to go.
DV
------------------
Click www.dallasvaughan.com for a good time </cheap_hits_generator>
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Feb 2001
Location: Charleston, SC
Status:
Offline
|
|
A hint on double-posts:
Never use the back button when you've previously posted something.
[This message has been edited by DV (edited 03-30-2001).]
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|