Ask coding questions

← Back to all posts
how can I compile C to nasm? all tools i find (objconv, c2nasm) are for windows

how can I compile C to nasm? all tools i find (objconv, c2nasm) are for windows and
WINE or dos2unix need sudo to install which i don't have


Ummm, nasm isn't a language. It's a compiler for x86 (and other types, but that's not important) Assembly.

If you want to create assembly code from a C or C++ file, you can feed the -S flag to gcc and it'll do that.


@SixBeeps but that can only create AT&T by default or intel, not NASM assembly (intel via --masm=intel)


@mkcodes Huh, that's interesting. I've just now taken a look at both objconf and c2nasm, I never knew there was actually a nasm flavor of assembly. Something about that seems strange to me, but /shrug.

Anyway, c2nasm doesn't look like it's specifically for Windows. In fact, it doesn't even natively support Bash scripts. Is it not working for you? It seems to run just fine for me.


@SixBeeps but it requires objconv, and when i unzipped it it just shows EXE file meaning its probably a windows terminal tool. (tester/objconv/objconv.exe) BUT it says u can run it on unix in help file ("The latter three platforms are all based on the UNIX heritage. I will use "Unix" as a common
name for Linux, BSD and Mac on x86 an x86-64 platforms in this manual. [..] The source code for objconv can be compiled and run under any of these platforms.")


@mkcodes ALSO i ran ./ ../main.c for somsething like int main(){return 0;} and it doesn't pass any test, so it works but raises errors


@mkcodes From the objconv documentation:

You need to build it. is located in /src/


@SixBeeps WAIT IKNOW WHAT TO DO!! we have to make it from source (stackoverflow)


@SixBeeps i just tried that and it says "permission denied"
EDIT: i got that part to work but now objconv doesn't read :/


@PikadaveStudios quoting from

  • Go to this site
  • Click on download and extract the
    Extract the and run for linux ( run objconv.exe for window ), this creates an executable objconv
  • move objconv to your binaries (do it now !!) or just run ./objconv (maybe you must run chmod 777 objconv before if you're not allowed)
    [note that i gave up on making objconv to work but there were instructions to make from source i just cant find it]