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. :)

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...

\DEV\MyProj.prj
\Dev\MySrc.asm
\Dev\includes\asm_io.inc

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

If your project is in a different folder...
\DEV\Proj\MyProj.prj
\Dev\MySrc.asm
\Dev\includes\asm_io.inc

Then it references your project either with a full path, or a delta path.
..\MySrc.asm
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

\Dev\PROJ\includes\asm_io.inc

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.
c:\Dev\include\asm_io.inc
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"
to
include 'asm_io.inc'

If it doesn't work
Try
%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.

Nope.
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 article has been dead for over six months. Start a new discussion instead.