www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Invalid Assembly Generated

reply "Bauss" <jj_1337 live.dk> writes:
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.
Oct 04 2014
next sibling parent "evilrat" <evilrat666 gmail.com> writes:
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.
Oct 04 2014
prev sibling parent Mike Parker <aldacron gmail.com> writes:
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
Oct 04 2014