www.digitalmars.com         C & C++   DMDScript  

D - Trying to compile "hello.d"...

reply "Juan Carlos Arevalo Baeza" <jcab roningames.com> writes:
   Ahem... I found a bit of time to stop loitering around and try the alpha
compiler out. This is how far I got:

---
C:\dm\samples\d>dmd -IC:\dm\src\phobos hello.d
D ALPHA Experimental release
www.digitalmars.com
C:\dm\src\phobos\object.d(2): printf symbol object.printf conflicts with
Object.printf at C:\dm\src\phobos\Object.d(2)
---

Salutaciones,
                         JCAB
Jan 23 2002
parent reply "Walter" <walter digitalmars.com> writes:
Try this:



int main(char[][] args)
{
    printf("hello world\n");
    printf("args.length = %d\n", args.length);
    for (int i = 0; i < args.length; i++)
 printf("args[%d] = '%s'\n", i, (char *)args[i]);
    return 0;
}



"Juan Carlos Arevalo Baeza" <jcab roningames.com> wrote in message
news:a2nit0$2om4$1 digitaldaemon.com...
    Ahem... I found a bit of time to stop loitering around and try the
alpha
 compiler out. This is how far I got:

 ---
 C:\dm\samples\d>dmd -IC:\dm\src\phobos hello.d
 D ALPHA Experimental release
 www.digitalmars.com
 C:\dm\src\phobos\object.d(2): printf symbol object.printf conflicts with
 Object.printf at C:\dm\src\phobos\Object.d(2)
 ---

 Salutaciones,
                          JCAB
Jan 23 2002
parent reply "Juan Carlos Arevalo Baeza" <jcab roningames.com> writes:
"Walter" <walter digitalmars.com> wrote in message
news:a2nodf$2s2j$2 digitaldaemon.com...
 Try this:

 int main(char[][] args)
 {
     printf("hello world\n");
     printf("args.length = %d\n", args.length);
     for (int i = 0; i < args.length; i++)
  printf("args[%d] = '%s'\n", i, (char *)args[i]);
     return 0;
 }
That's what "hello.d" contains. But it also has the following at the beginning: --- import Object; import c.stdio; --- which is indeed the problem. If I comment those two out, it works. I suggest you include this fix for the next release. So, what's happening? Is it automatically importing those, wether you want them or not? :-P Salutaciones, JCAB
Jan 23 2002
parent reply "Walter" <walter digitalmars.com> writes:
I've been rewriting object.d and stdio.d. -Walter

"Juan Carlos Arevalo Baeza" <jcab roningames.com> wrote in message
news:a2npsv$2t0f$1 digitaldaemon.com...
 "Walter" <walter digitalmars.com> wrote in message
 news:a2nodf$2s2j$2 digitaldaemon.com...
 Try this:

 int main(char[][] args)
 {
     printf("hello world\n");
     printf("args.length = %d\n", args.length);
     for (int i = 0; i < args.length; i++)
  printf("args[%d] = '%s'\n", i, (char *)args[i]);
     return 0;
 }
That's what "hello.d" contains. But it also has the following at the beginning: --- import Object; import c.stdio; --- which is indeed the problem. If I comment those two out, it works. I suggest you include this fix for the next release. So, what's happening? Is it automatically importing those, wether you want them or not? :-P Salutaciones, JCAB
Jan 23 2002
parent reply "Juan Carlos Arevalo Baeza" <jcab roningames.com> writes:
"Walter" <walter digitalmars.com> wrote in message
news:a2nt3p$2v4f$1 digitaldaemon.com...
 "Juan Carlos Arevalo Baeza" <jcab roningames.com> wrote in message
 news:a2npsv$2t0f$1 digitaldaemon.com...
    So, what's happening? Is it automatically importing those, wether you
 want them or not? :-P
I've been rewriting object.d and stdio.d. -Walter
So? What has the one thing to do with the other? Am I missing a point here? :-P Salutaciones, JCAB
Jan 23 2002
parent reply "Walter" <walter digitalmars.com> writes:
"Juan Carlos Arevalo Baeza" <jcab roningames.com> wrote in message
news:a2ntni$2vfp$1 digitaldaemon.com...
 "Walter" <walter digitalmars.com> wrote in message
 news:a2nt3p$2v4f$1 digitaldaemon.com...
 "Juan Carlos Arevalo Baeza" <jcab roningames.com> wrote in message
 news:a2npsv$2t0f$1 digitaldaemon.com...
    So, what's happening? Is it automatically importing those, wether
you
 want them or not? :-P
I've been rewriting object.d and stdio.d. -Walter
So? What has the one thing to do with the other? Am I missing a point here?
It has everything to do with the error message you got, that printf() was defined in both modules.
Jan 23 2002
next sibling parent John Fletcher <J.P.Fletcher aston.ac.uk> writes:
Walter wrote:

 "Juan Carlos Arevalo Baeza" <jcab roningames.com> wrote in message
 news:a2ntni$2vfp$1 digitaldaemon.com...
 "Walter" <walter digitalmars.com> wrote in message
 news:a2nt3p$2v4f$1 digitaldaemon.com...
 "Juan Carlos Arevalo Baeza" <jcab roningames.com> wrote in message
 news:a2npsv$2t0f$1 digitaldaemon.com...
    So, what's happening? Is it automatically importing those, wether
you
 want them or not? :-P
I've been rewriting object.d and stdio.d. -Walter
So? What has the one thing to do with the other? Am I missing a point here?
It has everything to do with the error message you got, that printf() was defined in both modules.
I have similar problems. I just downloaded the latest alpha and have these conflict messages running the sample code. John
Jan 24 2002
prev sibling parent "Juan Carlos Arevalo Baeza" <jcab roningames.com> writes:
"Walter" <walter digitalmars.com> wrote in message
news:a2ocm2$76r$1 digitaldaemon.com...
 "Juan Carlos Arevalo Baeza" <jcab roningames.com> wrote in message
 news:a2ntni$2vfp$1 digitaldaemon.com...
 "Walter" <walter digitalmars.com> wrote in message
 news:a2nt3p$2v4f$1 digitaldaemon.com...
 "Juan Carlos Arevalo Baeza" <jcab roningames.com> wrote in message
 news:a2npsv$2t0f$1 digitaldaemon.com...
    So, what's happening? Is it automatically importing those, wether
you
 want them or not? :-P
I've been rewriting object.d and stdio.d. -Walter
So? What has the one thing to do with the other? Am I missing a point here?
It has everything to do with the error message you got, that printf() was defined in both modules.
But the conflict was between object.printf and Object.printf! c.stdio had nothing to do with it, AFAICS. And that does sound to me like a bug of some kind... And if I remove both imports, it seems to be able to find printf anyway... magically... Is that normal? My guess is that the compiler "introduces" an "import object;" statement before the source code begins. Then, the sample has a "import Object;" statement up top, and thus the problem: the same module is read twice. Salutaciones, JCAB
Jan 24 2002