compiling assembly in linux with nasm

This is a discussion on compiling assembly in linux with nasm within the Linux Programming forums, part of the Platform Specific Boards category; So I started messing around with assembly but I am having some issues compiling. From the directions on one page ...

  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    4

    compiling assembly in linux with nasm

    So I started messing around with assembly but I am having some issues compiling.

    From the directions on one page I followed i did
    Code:
    nasm -f elf program1.asm
    ls program1.o -o program1
    But then I got this error message
    Code:
    ld: i386 architecture of input file `program1.o' is incompatible with i386:x86-64 output
    So I looked up the error and there wasnt a clear answer, but it seems the linker is trying to do 64 bit and nasm is doing 32bit? Am I on the right track?

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,251
    If your version of NASM is 2.00 or greater, try using "-f elf64" instead of "-f elf"
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling Linux kernel on Windows
    By jmd15 in forum Linux Programming
    Replies: 9
    Last Post: 04-10-2006, 07:28 AM
  2. Compiling a C program in Linux
    By hern in forum C Programming
    Replies: 14
    Last Post: 06-28-2004, 08:33 PM
  3. Code not compiling in Linux
    By CompiledMonkey in forum C++ Programming
    Replies: 5
    Last Post: 06-22-2004, 09:06 AM
  4. Linux for Windows!
    By Strut in forum Linux Programming
    Replies: 2
    Last Post: 12-25-2002, 10:36 AM
  5. Linux? Windows Xp?
    By VooDoo in forum Linux Programming
    Replies: 15
    Last Post: 07-31-2002, 08:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21