Author Topic: Cannot execute my Program!  (Read 5299 times)

Zweistein

  • Guest
Cannot execute my Program!
« on: June 29, 2007, 04:37:52 pm »
Hello,

I am very new to CodeBlocks. I downloaded Nightly Builds SVN 4193 from today. I created a Project which uses the Digital Mars D Compiler. It compiles fine and i get a *.exe file. When i try to run that in CodeBlocks, nothing happens. Just the Build Log Console gets Empty... When i run in in my Dos Window, it works fine. Its just a Hello World Test.

My Executable is there: C:\DProgramming\Projects\CB_TowerDefense\bin\Release\CB_TowerDefense.exe
My Project there: C:\DProgramming\Projects\CB_TowerDefense\CB_TowerDefense.cbp
And CodeBlock there: C:\DProgramming\CodeBlocks\codeblocks.exe

MFG
http://d.whosme.de

Offline skirby

  • Almost regular
  • **
  • Posts: 137
Re: Cannot execute my Program!
« Reply #1 on: June 29, 2007, 04:54:23 pm »
I think it is because MS Dos program close itself at the end of execution (in release mode).
You should put a pause or something like that at the end of your program.

In C program, you can use system("PAUSE");
I don't know if it works in D language.


EDIT:
I have just download D compiler and test it into C::B.
No problem. I can execute the program from C::B editor (run program with F9)

Here is what I have on my screen.
Quote
hello world
args.length = 1
args[0] = 'D:\TestD\bin\Release\TestD.exe'

Process returned 0 (0x0)   execution time : 0.000 s
Press any key to continue.
« Last Edit: June 29, 2007, 05:06:18 pm by skirby »

Zweistein

  • Guest
Re: Cannot execute my Program!
« Reply #2 on: June 29, 2007, 05:20:48 pm »
mh, i programmed something like:

void main {
 writefln("test");
 char[] a;
 readln(a);

}


So it should not quit before i write something in there...

Offline skirby

  • Almost regular
  • **
  • Posts: 137
Re: Cannot execute my Program!
« Reply #3 on: June 29, 2007, 05:28:31 pm »
I have written this simple program and it works perfectly.

Code
import std.stdio;
import std.stream;

int main(char[][] args)
{
    writefln("Please, enter something:");

    char[] a;
    readln(a);

    writefln("You have written: %s", a);

    return 0;
}

Zweistein

  • Guest
Re: Cannot execute my Program!
« Reply #4 on: June 29, 2007, 05:50:24 pm »
Yeah, works for me, too. Maybe you have tu use that "int main(char[][] args)" as main function and not void main()...

bye