FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How am I supposed to work?

 
Post new topic   Reply to topic     Forum Index -> Tutorials
View previous topic :: View next topic  
Author Message
Mastermind



Joined: 23 May 2007
Posts: 4

PostPosted: Wed May 23, 2007 9:54 am    Post subject: How am I supposed to work? Reply with quote

Hello. I'm new here and sry for my bad English in advance. It's not my native language.

I wish to try out D and installed the compiler. (I use ConTEXT as the editor.) It works. But there are 2 problems:

1. All the programs quit immediately. A program that has a neverending for loop like this:

Code:

import std.stdio;

int main()
{
  for (int i = 1; i > 0; i++)
    writefln(i);
  return 0;
}


does indeed never end and shows me, that compiling does work. But how on earth am I supposed to use a normal program?


2. The Wiki says you have to use cmd to compile. I know this is something I'm not paying for and so on and so on. I don't want to harass you. But common! It's 2007 now! Nobody wants to use command lines! However, I was not able to find one single working IDE. Did I miss something or is there not a single GUI for compiling nearly half a year after 1.0? All I want is to have an editor with a button "compile" that does the same as dmd and can even use dmd. I don't care. For example I tried Zeus, but it was complicated and did not produce any .exe. Eclipse doesn't seem to have a proper PlugIn and is far more complicated than necessary. So, is there any program suitable for me?
Back to top
View user's profile Send private message
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Wed May 23, 2007 1:19 pm    Post subject: Reply with quote

You can try poseidon: http://www.dsource.org/projects/poseidon
And look here: http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport
Back to top
View user's profile Send private message
cracki



Joined: 07 May 2007
Posts: 10
Location: Germany

PostPosted: Wed May 23, 2007 2:33 pm    Post subject: Reply with quote

if you start console programs, which the pasted code of yours clearly is, they open a console and close it when they're done. that's what console programs do.

all C, C++ and D newbies ask that same question: "why does my program just flash very briefly and then terminate?"
_________________
...meh...
Back to top
View user's profile Send private message
Mastermind



Joined: 23 May 2007
Posts: 4

PostPosted: Wed May 23, 2007 3:27 pm    Post subject: Reply with quote

cracki wrote:
if you start console programs, which the pasted code of yours clearly is, they open a console and close it when they're done. that's what console programs do.

all C, C++ and D newbies ask that same question: "why does my program just flash very briefly and then terminate?"

Great.

1. I have tried C++ a while ago. There was no problem of that kind. If I remember correctly I was using some microsoft IDE suite and it had a console built in and this console was not terminating at the end but said it was done and you had to terminate it.

2. As we now all know, all newbies ask the same question. Interesting. Then, why is there not a single hint for that problem? There are source examples and tutorials for beginners. They simply show you the code. Now what? Do they like making fun of newbies? Or how is this supposed to work?

3. Whats the solution for that problem? How about a not terminating console? Or how about a hint for some kind of "halt" code or codeword?


You know, sometimes I have the feeling that people engaged in the open source community are not really interested in a growing community. This is not my first experience of that kind. Maybe these people went through hell to make their programs work and want others to go through hell as well? Maybe they like the feeling of being something special by using some hardly known software and want to keep it "secret"?

I dunno why most open source projects massivly lack of user-friendliness, but it's a pitty.
Back to top
View user's profile Send private message
Mastermind



Joined: 23 May 2007
Posts: 4

PostPosted: Wed May 23, 2007 3:34 pm    Post subject: Reply with quote

doob wrote:
You can try poseidon: http://www.dsource.org/projects/poseidon
And look here: http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport

Thanks.
I tried poseidon and it didn't produce any .exe
First... is it supposed to do so? I already figured out to install Bud and set the directories for both Bud and dmd correct.

-if I set to use dmd for compiling, the project window doesn't show my sourcecode!

-if I set to use Bud for compiling, it compiles me some .obj file, but no .exe

And I have already seen the list. It's a mess. So many projects, but many are not developed anymore. And most of them are not the kind of program I was searching for. Most of them are simple editors.

So Poseidon seems to be OK. But how do I get it to produce some .exe?
Back to top
View user's profile Send private message
cracki



Joined: 07 May 2007
Posts: 10
Location: Germany

PostPosted: Wed May 23, 2007 4:27 pm    Post subject: Reply with quote

put that in a recompile_and_run.bat:
Code:
@echo off
del yoursource.exe
dmd yoursource.d
yoursource.exe
pause


doubleclick it.
_________________
...meh...
Back to top
View user's profile Send private message
Mastermind



Joined: 23 May 2007
Posts: 4

PostPosted: Wed May 23, 2007 5:01 pm    Post subject: Reply with quote

cracki wrote:
put that in a recompile_and_run.bat:
Code:
@echo off
del yoursource.exe
dmd yoursource.d
yoursource.exe
pause


doubleclick it.

Thanks!
An awesome workaround (for a problem that should never have existed in the first place Laughing Wink )
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Wed May 23, 2007 11:09 pm    Post subject: Reply with quote

Funny, I've never had that problem, and don't even use an IDE. (I've been using EditPlus2 since I first discovered D years ago.) On Windows my process is this:

1. Run a command prompt. (Start+R, 'cmd', Enter. Or 'command' on Win98.)

2. 'devcon', Enter. Which runs this batch file, devcon.bat:
@echo off
prompt $E[1;34m$P$G$E[0m
e:
cd \projects
doskey

3. Compile and run program. Repeat this step as neccessary.

4. When done working on the project: 'exit', Enter.

This is the same process I've used for years with D, C/C++, Java, Ruby, Python, etc. The only time I've found much use for an IDE was with Java, where I admit to using JBuilder a fair amount of time -- mainly for the sake of auto-completion (invaluable for a language with such an extensive standard library).
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
bmeck



Joined: 22 May 2007
Posts: 6

PostPosted: Thu May 24, 2007 3:23 am    Post subject: Reply with quote

I'm with most of the guys here and I use a .bat, except I make it so that the file opens with this. Open up the text editor, make sure the files are set to go to this .bat and enjoy.

Code:
@echo off
cd %~p1
if exist "%~n1.def" (
   @echo on
   dmd "c:\d\dmd\lib\ws2_32.lib" "%~n1.def" %1
) else (
   @echo on
   dmd "c:\d\dmd\lib\ws2_32.lib" %1
)
@echo off
echo Would you like to run the program. Will exit without running after 5 seconds. (y/n)?
choice /c yn /t 5 /n /d n
If not errorlevel == 2 if errorlevel == 1 (
   @echo on
   "%~n1.exe"
   pause
)

I'm with you on needing to get a community trying to expand the current program learning curve of D so im trying to start up a tutorial if you want to help anyone please do! Threw this .bat in there too.
http://dsource.org/projects/tutorials/wiki/LearningD-Installation
Back to top
View user's profile Send private message Send e-mail
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Thu May 24, 2007 4:49 am    Post subject: Reply with quote

I never had the problem in poseidon with not building a .exe file.
I'm using poseidon 0.22 and bud (build). If you have entered the correct compiler, linker, and bud path you should get a .exe file if you press the build button. I use the following compiler switches: -w -unittest -O -inline -debug and the following bud switches: -full -cleanup. You can also try to enter a target name in the project property (right click on the project).

I've noticed if you then press the run button the cmd window will just flash by, but there's a workaround.

Press the arrow on the green/red button and choose customize , then you can add a run configuration. For example: name: Run, command: $(ProjectName).exe or $(ProjectMainFile).exe (or whatever filename is produced by bud, I think it should be $(ProjectMainFile) if no target name is selected) then make sure all three check boxes are checked and press OK. Then you just press the green/red (tool tip should now be Run) button to run the project, you will not see a cmd window but poseidon will catch the output and put it in the output tab.
Back to top
View user's profile Send private message
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Thu May 24, 2007 4:56 am    Post subject: Reply with quote

Then you have the eclipse plugin descent: http://www.dsource.org/projects/descent
I don't think it is as complete as poseidon, no autocompletion etc.
Make sure you read the documentation.

And a Visual Studio plugin http://www.dsource.org/projects/vsplugind
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Thu May 24, 2007 7:13 am    Post subject: Reply with quote

bmeck wrote:
I'm with you on needing to get a community trying to expand the current program learning curve of D so im trying to start up a tutorial if you want to help anyone please do! Threw this .bat in there too.
http://dsource.org/projects/tutorials/wiki/LearningD-Installation
Looks good. Thanks for doing this.

I hope you don't mind that I've added some links at the bottom of the page for related Wiki4D pages in case people want more suggestions.
Back to top
View user's profile Send private message AIM Address
turbowwsr



Joined: 05 Aug 2007
Posts: 1
Location: here

PostPosted: Sun Aug 05, 2007 7:27 pm    Post subject: Reply with quote

Hi,

I am also a newbie to D. I am learning C# at the moment and like the syntax and style, but not the MS only .Net (dotGNU and MONO only promote MS's Monopoly and are helping MS extinguish Java and Sun).

I found D to be more C# and Java like in style. I've had the same problem with the DOS console, even with open source C# IDE's.

Here is my solution:

in Main call a module ie;

Code:

import std.stdio;    //calls std.c.stdio so no need to import it also
import std.process;  //for system("pause")
import std.c.windows.windows;
 
void main()
{
    all your modules here;
    Wait();
}

void Wait()
{
    writef("Press any key to continue...");
    system("pause");
    return 0;
}


This small statement could be placed within main or can be changed to do whatever a newb would like. It keeps the console screen open until a key is press. Just make sure all your needed code has done it's job first.

This code may be copied. Computer language is as spoken or written language, and no one owns words. (Tho MS may have a patent on them Smile
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Tutorials All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group