I am doing a tutorial on Assembly, and I have ran into this error: fatal: Unable to open include file "includes/asm_io.inc" Here is my code:

%include "includes\asm_io.inc"
MOV    EAX, 3     ;EAX = 3
ADD    EAX, 4     ;EAX = EAX + 4
INC    EAX        ;EAX++
CALL   print_int  ;cout << EAX
CALL   print_nl   ;cout << '\n'

I have the asm_io.inc file in the includes folder which is in the same folder as my code.

Any help would be appreciatedd. :)

7 Years
Discussion Span
Last Post by tomtetlaw

And is the folder actually named includes ?
Normally its named include
But if its your folder!

working path is usually where the project is located, not the source files. See if you can add the includes folder to the project!

It doesn't appear you are using MASM as its method is...
include KariType.inc

Are you sure its not suppose to be single quotes not double?

%include 'includes\asm_io.inc'


I'm using NASM.
What do you mean by
"working path is usually where the project is located, not the source files. See if you can add the includes folder to the project!"


Did you make the change...

%include 'includes\asm_io.inc'

...as I recommended? I believe NASM uses only single quotes like other assemblers.

As to workspaces...


If your project exists in the same folder as your assembly file then not a problem.

If your project is in a different folder...

Then it references your project either with a full path, or a delta path.
But its default file path is where the project file is. If one of those assembly files includes a file then the path will be messed up becase the assembler will be looking at


But your more likely problem is the quotes. If that doesn't fix it. then try to hard code the include path as a test.
If that works, then it's a delta path problem.
You might need...
%include '..\includes\asm_io.inc'


My asm file and the asm_io.inc file are in the same folder, now i changed it to %include 'asm_io.inc' and it still gave me the same error


Where's the project file?

Change the %include 'asm_io.inc"
include 'asm_io.inc'

If it doesn't work
%include 'c:\yourfolder\includes\asm_io.inc"

give it a full path!


Okay, I grabbed NASM. (I normally use MASM) and you had a correct method of include!

%include "asm_io.inc"

That appears to leave a path problem.


I downloaded NASM and the libraries.
Everything in on folder worked fine.
Moving the INC file to a includes folder worked fine.
Moving the tools to another folder with the working folder being the one containing the .asm was fine.

BUT If my working folder was NOT the folder containg the ASM file then it fails to find the asm_io

So as I mentioned before about working folders.

If building it from a DOS shell then the .ASM must be visible in that folder.


Now I get this error:

c:/program files/gcc/tmp/cceR7rQK.o:driver.c:(.text+0x12):undefined reference to '_asm_main'
collect2: 1d returned 1 exit status

any help would be appreciated

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.