Find the answer to your Linux question:
Results 1 to 4 of 4
hello. how would i compile something on linux but so it can run on windows. it's not complicated. the code compiles on both windows and linux. but if i compile ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2004
    Posts
    34

    compiling executable


    hello.

    how would i compile something on linux but so it can run on windows.

    it's not complicated. the code compiles on both windows and linux. but if i compile it only linux and run it on windows i get this error "The NTVDM has encountered an illegal instruction. CS:054f ..."

    =D this is how i compile it. i think this is where the problem is. but i am a noob

    $ g++ -o file.exe file1.cpp file2.cpp

    if i do ./file.exe
    it works just fine. on linux. but cant run it on windows.

    thank you

  2. #2
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    Just putting a .exe on the file does NOT make it a valid Windows/DOS executable. You'll have to either A) compile the code on a Windows box or B) use gcc to compile the source into a Windows binary as the "Cross Compiling" section in this article instructs.
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  3. #3
    Just Joined!
    Join Date
    Jun 2004
    Posts
    34
    oh i knew that. i just thought it'd help it read it =D

    what i didnt know is that it compiles different on linux =)

    thanks a lot

  4. #4
    Just Joined!
    Join Date
    Jun 2004
    Posts
    34
    ah cross compiling's too hard for me right now =D

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •