www.digitalmars.com         C & C++   DMDScript  

c++ - using COUT with DMC 7.5

reply robert <robert 13c.com> writes:
Hello fellow programmers,

This is my first attempt to make use of the DMC compiler,
and it's proving to be an uphill climb.  My program is very
simple, wanting to write a string out to the console, like
this:

   #include <iostream.h>
   int main()
       {
       cout << "Hello World...\n";
       }

When I try running this under the debugger, attempt to step
over the COUT are met with an assembly window popping open,
with a caption that says "Unknown Procedure".

I'm sure that I need to link with some library, or something
similar, but I've been stuck for quite a while.

Thanks in advance for any help you can provide,
Robert
May 16 2008
next sibling parent reply torhu <no spam.invalid> writes:
robert wrote:
 Hello fellow programmers,
 
 This is my first attempt to make use of the DMC compiler,
 and it's proving to be an uphill climb.  My program is very
 simple, wanting to write a string out to the console, like
 this:
 
    #include <iostream.h>
    int main()
        {
        cout << "Hello World...\n";
        }
 
 When I try running this under the debugger, attempt to step
 over the COUT are met with an assembly window popping open,
 with a caption that says "Unknown Procedure".
 
Do you get any error message from the compiler or linker? That code works just fine for me.
May 16 2008
next sibling parent robert <robert 13c.com> writes:
== Quote from torhu (no spam.invalid)'s article
 Do you get any error message from the compiler or linker?  That
code
 works just fine for me.
Nope no error message from compiler nor from the linker. That's the strange part, because if there had been an error, I would have fixed that (before asking questions here). What version of DMC are you running? Because, admittedly, mine is years out of date; although, I can't see why/how that would matter. Did you have to set any particular linker options, so that it would know which libraries to use? This code is so simple, that I'm surprised it won't work. Thanks for the reply, and for any further clues you might have.
May 16 2008
prev sibling parent robert <robert 13c.com> writes:
== Quote from torhu (no spam.invalid)'s article
 robert wrote:
 Hello fellow programmers,

 This is my first attempt to make use of the DMC compiler,
 and it's proving to be an uphill climb.  My program is very
 simple, wanting to write a string out to the console, like
 this:

    #include <iostream.h>
    int main()
        {
        cout << "Hello World...\n";
        }

 When I try running this under the debugger, attempt to step
 over the COUT are met with an assembly window popping open,
 with a caption that says "Unknown Procedure".
Do you get any error message from the compiler or linker? That
code
 works just fine for me.
Nope, didn't get any compiler or linker errors. If I had, I would have fixed them before posting here. Did you use any special linker options to get it to run? It's such simplistic code, I am surprised that it is so difficult to get it working. Thanks for the reply, and for any other clues that come to mind.
May 17 2008
prev sibling parent Heinz Saathoff <newshsaat arcor.de> writes:
Hello,

robert wrote...
    #include <iostream.h>
    int main()
        {
        cout << "Hello World...\n";
        }
 
 When I try running this under the debugger, attempt to step
 over the COUT are met with an assembly window popping open,
 with a caption that says "Unknown Procedure".
 
 I'm sure that I need to link with some library, or something
 similar, but I've been stuck for quite a while.
I haven't used the debugger yet because I'm mostly writing/maintaining DOSX programs. But just a guess: When you step over the debugger might look for the next statement to halt. But in your program the cout line is the only statement present. You can try to add a dummy statement, so that your program looks like this: int main() { int ret; cout << "Hello World...\n"; ret = 19; // dummy statement return ret; // another one } - Heinz
May 21 2008