News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Cannot execute my Program!

Started by Zweistein, June 29, 2007, 04:37:52 PM

Previous topic - Next topic

Zweistein

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

skirby

#1
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.
Quotehello 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.

Zweistein

mh, i programmed something like:

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

}


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

skirby

I have written this simple program and it works perfectly.

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

Yeah, works for me, too. Maybe you have tu use that "int main(char[][] args)" as main function and not void main()...

bye