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

Recommended Answers

All 12 Replies

It needs to be in your include path.
Which 32-bit assembler are you using?

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!

Any sample files with NASM ? See how they include files!

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.

Try this. Maybe It's a C thing.

%include "includes//asm_io.inc"

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.

I gave it a full path and it worked, thank you

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.