 |
 |
How do I run a C++ console app on its own?
|
 |
|
 |
|
Forum Regular
Join Date: Apr 2001
Location: St. Louis
Status:
Offline
|
|
I have created a small C++ program in Project Builder, How do I compile it so that it runs independently from PB? Is this possible--I know it was in Code Warrior Pro 3--but I would like to be able to do this in OS X without expelling $$$$$$$$$$  .
Thanks,
JARinteractive
[ 09-08-2001: Message edited by: jarinteractive ]
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status:
Offline
|
|
If you have installed the dev tools, it comes with c++. It'll do the thang
[localhost:~] fahrenba% pic program.c
.lf 1 program.c
#include <iostream.h>
int main()
{
cout << "Welcome";
return 0;
}
[localhost:~] fahrenba% c++ program.c
[localhost:~] fahrenba% ./a.out
Welcome[localhost:~] fahrenba%
HTH,
F-bacher
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Apr 2001
Location: St. Louis
Status:
Offline
|
|
could you explain this in more detail, please. Sorry for my ignorance!
JARinteractive
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status:
Offline
|
|
What he means is that there is a command-line program installed by the dev tools installer called "c++".
It is a c++ compiler. By typing "c++ program.c" you compile the program.c file into an "a.out" binary. When you type "./a.out" it will execute this binary.
I think that there is a "-o <name>" option that lets you specify the name of the finished binary but I am not sure.
Does that answer your question?
Jeff.
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
I think he might want a SIOUX-like app (double-click, it launches and you get a window which you can use to manipulate stdin/stdout). There are no SIOUX libraries under OS X, if you want a commandline app you must use the, uh, commandline
I think that CW Pro 6 does have SIOUX libraries, so if you *REALLY* need to you can buy that, but you'd be better off writing a GUI 
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Apr 2001
Location: St. Louis
Status:
Offline
|
|
thank-you guys! I have it running in the terminal.
JARinteractive
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Apr 2001
Location: St. Louis
Status:
Offline
|
|
It would be nice if someone would create program that would run command-line programs in a window  . I'm sure this would be very useful to other students working with C++, too. I would create it, but I don't have experience programming in Objective-C, cocoa, etc. Only C++, REALbasic, PHP, and Javascript. (I would like to learn to write Cocoa apps, though.)
JARinteractive
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Apr 2001
Status:
Offline
|
|
It would be nice if someone would create program that would run command-line programs in a window . I'm sure this would be very useful to other students working with C++, too.
Um, no offense, but why would someone create a program to run command-line programs in a window when all you have to do is open a terminal and run the program?
Wade
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status:
Offline
|
|
He's thinking of how CodeWarrior does it - when you run your command line programs, it spawns a window with the output. It's really silly, but I guess it could be kind of reassuring to a novi programmer.
F-bacher
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
Originally posted by Ghoser777:
<STRONG>He's thinking of how CodeWarrior does it - when you run your command line programs, it spawns a window with the output. It's really silly, but I guess it could be kind of reassuring to a novi programmer.</STRONG>
It's not silly when you consider that otherwise there would be no way of getting access to stdin/stdout on Classic (apart from using files, I guess).
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Mar 2001
Location: Park Ridge, NJ, USA
Status:
Offline
|
|
I think I'm having a problem with missing header files...
Here's what happened when I tried to compile my program with "c++ virtfunc.cpp":
In file included from /usr/include/gcc/darwin/2.95.2/g++/libio.h:30,
from /usr/include/gcc/darwin/2.95.2/g++/streambuf.h:36,
from /usr/include/gcc/darwin/2.95.2/g++/iostream.h:31,
from virtfunc.cpp:1:
/usr/include/gcc/darwin/2.95.2/g++/_G_config.h:4: sys/types.h: No such file or directory
/usr/include/gcc/darwin/2.95.2/g++/_G_config.h:85: stddef.h: No such file or directory
In file included from /usr/include/gcc/darwin/2.95.2/g++/streambuf.h:36,
from /usr/include/gcc/darwin/2.95.2/g++/iostream.h:31,
from virtfunc.cpp:1:
/usr/include/gcc/darwin/2.95.2/g++/libio.h:59: sys/cdefs.h: No such file or directory
/usr/include/gcc/darwin/2.95.2/g++/libio.h:275: stdio.h: No such file or directory
Any ideas?
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
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
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|