what target/platform to use

what target/platform to use

Post by Rob C » Tue, 07 Oct 2003 02:10:37

I copied this code out of a text book, but I didn work this
module into a project, but instead just compiled and ran it. It
runs fine.

But, now, when I attempt to work it into a project (Target type:
[Application], platform: [Win32]), I get a dialog box that
says, ou have accidentally used a dummy version of OwlMain.
Please, how can I fix this?


class Queue
int Q[100];
int sloc, rloc;
int who;

Queue( int id );
void Qput( int i );
int Qget();

Queue::Queue( int id )
sloc=rloc = 0;
who = id;
cout<<< "Queue "<<< who<<< " intitialized\n\n";


cout<<< "Queue "<<< who<<< " destroyed \n\n";


void Queue::Qput( int i )
if( sloc == 100 )
cout<<< "Queue overflow";

int Queue::Qget()
if( rloc == sloc )
cout<<< "Queue overflow";
return 0;
return Q[rloc];

Queue a(1), b(2);



cout<<< "Contents of Queue a & b : ";
cout<<< a.Qget()<<< " ";
cout<<< a.Qget()<<< " ";
cout<<< b.Qget()<<< " ";
cout<<< b.Qget()<<< " \n";


return 0;


what target/platform to use

Post by Ed Mulroy » Tue, 07 Oct 2003 03:24:11

When you created the project the TargetExpert dialog had settings for the
target type but also a checkbox for if you were using the Object Windows
Library, OWL. When you create an OWL program without the function OwlMain
(where OWL programs begin), it links in a routine from the library which
contains code to warn you of the mistake. That is what happened here.

A Win32 console mode program begins at the function main, and is a text mode
program just as you show.

Go to the project window and right click on the EXE file name.
Select TargetExpert from the window which appears
Set the platform and target type to Win32 Console

Afterwards do a Save All and a Project Build All

You might also want to check the date of that textbook. The function main
returns an int and C++ no longer assumes an int return type if no return
type is given. While the compiler is rigged to let you get away with it
because of the number of people maintaining legacy code, a book to learn
from really should reflect the level of the C++ language at least as new as
from 5 years ago.

. Ed