Thread overview
Invalid Assembly Generated
Oct 04, 2014
Bauss
Oct 04, 2014
evilrat
Oct 04, 2014
Mike Parker
October 04, 2014
I am not able to run the output file compiled. I am not sure if it might be an error with my commandline or not.

Operating System: Windows 8
Commandline Arguments Try1: -c hello.d out\hello.exe
Commandline Arguments Try2: -c hello.d -m32 out\hello.exe

hello.d:
import std.stdio;

void main()
{
	writeln("Hello World!");
	readln();
}

When I run the executable generated Windows 8 says "This app can't run on your PC" "To find a version for your PC, check with the software publisher."

I figured that it might be because it compiles x64 and I have to run x86, but I already tried compiling it as x86 using -m32.
October 04, 2014
On Saturday, 4 October 2014 at 09:40:24 UTC, Bauss wrote:
> I am not able to run the output file compiled. I am not sure if it might be an error with my commandline or not.
>
> Operating System: Windows 8
> Commandline Arguments Try1: -c hello.d out\hello.exe
> Commandline Arguments Try2: -c hello.d -m32 out\hello.exe
>
> hello.d:
> import std.stdio;
>
> void main()
> {
> 	writeln("Hello World!");
> 	readln();
> }
>
> When I run the executable generated Windows 8 says "This app can't run on your PC" "To find a version for your PC, check with the software publisher."
>
> I figured that it might be because it compiles x64 and I have to run x86, but I already tried compiling it as x86 using -m32.

you don't need that -c , it means do not link, of course you get "This app can't run..." with this.
October 04, 2014
On 10/4/2014 6:40 PM, Bauss wrote:
> I am not able to run the output file compiled. I am not sure if it might
> be an error with my commandline or not.
>
> Operating System: Windows 8
> Commandline Arguments Try1: -c hello.d out\hello.exe
> Commandline Arguments Try2: -c hello.d -m32 out\hello.exe
>

Your command lines create an object file, not an executable, because you've passed -c, which means compile but don't link. To compile an executable out\hello.exe, this is what you want:

dmd hello.d -ofout\hello.exe

The -of switch tells the compiler how to name the output. Though it's apparently unneeded when compiling object files with -c as you did above, it is required when renaming an executable.

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com