Re: Compiling D through command line

2014-03-07 Thread Bauss

- I apologize for it all, my bad.

It wasn't even a problem with the compiler nor arguments.

I thought I had file extensions to show, so my main.d was 
actually main.d.txt


Explains why it couldn't read the file.

Fixed and got everything compiled fine.


Re: Compiling D through command line

2014-03-07 Thread Bauss

On Friday, 7 March 2014 at 18:07:00 UTC, Steve Teale wrote:

On Friday, 7 March 2014 at 16:59:30 UTC, Bauss wrote:
What arguments would I do to compile a d project through 
command line. Been trying a few things, but can't get it 
working.


I always get "Error: cannot read file x"

Read around the net and it most says it's an installation 
error and that reinstalling should fix it, but it works when 
compiling through a few IDE's so I assume it's mistake of my 
own.


Tried like this:
-c c:\testproject\main.d -m32 -ofc:\testd\out.exe



Take a step back. Your file is in folder c:\testproject, so do

cd \testproject
dmd main.d

Then look for a file called main.exe in the \testproject 
folder. I may be off the mark, since I have not used dmd under 
Windows for quite a long time, but try it.


Well trying what you all suggest still no results.

http://prntscr.com/2yqfhi


Re: Compiling D through command line

2014-03-07 Thread Steve Teale

On Friday, 7 March 2014 at 16:59:30 UTC, Bauss wrote:
What arguments would I do to compile a d project through 
command line. Been trying a few things, but can't get it 
working.


I always get "Error: cannot read file x"

Read around the net and it most says it's an installation error 
and that reinstalling should fix it, but it works when 
compiling through a few IDE's so I assume it's mistake of my 
own.


Tried like this:
-c c:\testproject\main.d -m32 -ofc:\testd\out.exe



Take a step back. Your file is in folder c:\testproject, so do

cd \testproject
dmd main.d

Then look for a file called main.exe in the \testproject folder. 
I may be off the mark, since I have not used dmd under Windows 
for quite a long time, but try it.


Re: Compiling D through command line

2014-03-07 Thread Jeremy DeHaan

On Friday, 7 March 2014 at 16:59:30 UTC, Bauss wrote:
What arguments would I do to compile a d project through 
command line. Been trying a few things, but can't get it 
working.


I always get "Error: cannot read file x"

Read around the net and it most says it's an installation error 
and that reinstalling should fix it, but it works when 
compiling through a few IDE's so I assume it's mistake of my 
own.


Tried like this:
-c c:\testproject\main.d -m32 -ofc:\testd\out.exe

And tried doing -v and it shows the correct information.

Anyone who got an example to achieve it. The documents doesn't 
explain it proper IMO as there is no example on compiling 
manual.




I would say that you should make sure that the files are where
you expect them to be. When using the console, iff you're in the
source directory you shouldn't need to specify a full path for
those files at least, which could help the compiler find them.
You can still specify the output directory for the exe.

On a side note, why use the m32 switch on Windows? That's the
default, so it isn't needed.


Re: Compiling D through command line

2014-03-07 Thread Bauss

On Friday, 7 March 2014 at 17:44:46 UTC, H. S. Teoh wrote:

On Fri, Mar 07, 2014 at 04:59:29PM +, Bauss wrote:
What arguments would I do to compile a d project through 
command

line. Been trying a few things, but can't get it working.


I always use the command line, and it has always worked fine 
for me.
(Caveat: I use Linux, so I've no idea if what I say applies to 
Windows

in any way.) It's simply:

dmd -ofprogram main.d module1.d module2.d ...

I assume on Windows it would be something like:

dmd.exe -ofprogram.exe main.d module1.d module2.d ...

Note that you do have to specify all source files, including 
any sources
in subdirectories that your code uses, otherwise you may get 
linker

errors.



I always get "Error: cannot read file x"

Read around the net and it most says it's an installation 
error and
that reinstalling should fix it, but it works when compiling 
through

a few IDE's so I assume it's mistake of my own.

Tried like this:
-c c:\testproject\main.d -m32 -ofc:\testd\out.exe


Why are you using -c? That is only if you want to separately 
compile
individual source files into object files without linking. If 
you're

trying to make an executable, you shouldn't be using -c.


T


Alright ty, but since you only specify the module names, how 
would it know to look in which path? Also do I have to specify 
all the modules from the std lib etc.?


Re: Compiling D through command line

2014-03-07 Thread H. S. Teoh
On Fri, Mar 07, 2014 at 04:59:29PM +, Bauss wrote:
> What arguments would I do to compile a d project through command
> line. Been trying a few things, but can't get it working.

I always use the command line, and it has always worked fine for me.
(Caveat: I use Linux, so I've no idea if what I say applies to Windows
in any way.) It's simply:

dmd -ofprogram main.d module1.d module2.d ...

I assume on Windows it would be something like:

dmd.exe -ofprogram.exe main.d module1.d module2.d ...

Note that you do have to specify all source files, including any sources
in subdirectories that your code uses, otherwise you may get linker
errors.


> I always get "Error: cannot read file x"
> 
> Read around the net and it most says it's an installation error and
> that reinstalling should fix it, but it works when compiling through
> a few IDE's so I assume it's mistake of my own.
> 
> Tried like this:
> -c c:\testproject\main.d -m32 -ofc:\testd\out.exe

Why are you using -c? That is only if you want to separately compile
individual source files into object files without linking. If you're
trying to make an executable, you shouldn't be using -c.


T

-- 
A program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes the potential for it to be applied to tasks that are
conceptually similar and, more important, to tasks that have not yet
been conceived. -- Michael B. Allen


Re: Compiling D through command line

2014-03-07 Thread Bauss

On Friday, 7 March 2014 at 17:08:24 UTC, Rene Zwanenburg wrote:

On Friday, 7 March 2014 at 16:59:30 UTC, Bauss wrote:
What arguments would I do to compile a d project through 
command line. Been trying a few things, but can't get it 
working.


I always get "Error: cannot read file x"

Read around the net and it most says it's an installation 
error and that reinstalling should fix it, but it works when 
compiling through a few IDE's so I assume it's mistake of my 
own.


Tried like this:
-c c:\testproject\main.d -m32 -ofc:\testd\out.exe

And tried doing -v and it shows the correct information.

Anyone who got an example to achieve it. The documents doesn't 
explain it proper IMO as there is no example on compiling 
manual.


I've not used dmd directly in ages, rdmd [1] is easier to use. 
It's included in the installation. Does that work for you?


http://dlang.org/rdmd.html


Nope still get the same compile error.
Compiling as such:
--build-only --force -ofc:\testd\out.exe c:\testproject\main.d

I'm sure I do it wrong.


Re: Compiling D through command line

2014-03-07 Thread Rene Zwanenburg

On Friday, 7 March 2014 at 16:59:30 UTC, Bauss wrote:
What arguments would I do to compile a d project through 
command line. Been trying a few things, but can't get it 
working.


I always get "Error: cannot read file x"

Read around the net and it most says it's an installation error 
and that reinstalling should fix it, but it works when 
compiling through a few IDE's so I assume it's mistake of my 
own.


Tried like this:
-c c:\testproject\main.d -m32 -ofc:\testd\out.exe

And tried doing -v and it shows the correct information.

Anyone who got an example to achieve it. The documents doesn't 
explain it proper IMO as there is no example on compiling 
manual.


I've not used dmd directly in ages, rdmd [1] is easier to use. 
It's included in the installation. Does that work for you?


http://dlang.org/rdmd.html


Compiling D through command line

2014-03-07 Thread Bauss
What arguments would I do to compile a d project through command 
line. Been trying a few things, but can't get it working.


I always get "Error: cannot read file x"

Read around the net and it most says it's an installation error 
and that reinstalling should fix it, but it works when compiling 
through a few IDE's so I assume it's mistake of my own.


Tried like this:
-c c:\testproject\main.d -m32 -ofc:\testd\out.exe

And tried doing -v and it shows the correct information.

Anyone who got an example to achieve it. The documents doesn't 
explain it proper IMO as there is no example on compiling manual.