Home > Software engineering >  NASM GoLink: "The following symbol was not defined in the object file or files"
NASM GoLink: "The following symbol was not defined in the object file or files"

Time:03-21

I'm new to assembly languages. I installed NASM and GoLink on Windows 10 and put their folder paths into Environment Variables in the advanced PC properties tab. I have a simple asm file with this program:

global _start

_start:
    mov eax, 1
    mov ebx, 42
    int 0x80

I run Command Prompt from the file folder and input following command:

nasm -f win32 test.asm -o test.obj

It successfully creates obj file in the same folder. Then I input this command:

golink /entry:_start /console kernel32.dll user32.dll test.obj

And I get the following error:

Error!
The following symbol was not defined in the object file or files:-
_start
You may be trying to link object files or lib code with decorated symbols -
If so, you could try using the /mix switch
Output file not made

I read that /entry appends a "_" to the name of the entry point but even with no underscore I get the same error.

How can I fix this?

CodePudding user response:

As commentators mentioned, section .text is required when compiling in Windows 10. Also, I used int 0x80 which is system call used on Linux systems so the program wouldn't work anyway.

  • Related