Code::Blocks Forums

User forums => Help => Topic started by: Zweistein on June 29, 2007, 04:37:52 pm

Title: Cannot execute my Program!
Post by: Zweistein 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
Title: Re: Cannot execute my Program!
Post by: skirby 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.
Title: Re: Cannot execute my Program!
Post by: Zweistein 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...
Title: Re: Cannot execute my Program!
Post by: skirby 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;
}
Title: Re: Cannot execute my Program!
Post by: Zweistein 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