Author Topic: about -I switch  (Read 3225 times)


  • Guest
about -I switch
« on: March 18, 2005, 05:07:22 PM »
I saw that the post was erased from "bugs", so I assumed is not a bug... very sorry for that... but then, what am I missing on the issue?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2429
  • Country: us
Re: about -I switch
« Reply #1 on: March 19, 2005, 02:21:23 AM »
Well... It *may* be that your bug-report was closed prematurely... but I don't *think* it's a "Nasm problem"...

AFAIK, the "-I" switch is working as documented.

The treatment of quoted strings is an OS issue - Nasm just processes what it gets... I think...

I'm puzzled that you report "*no* input file given"... typically, Nasm complains about "more than one input file" in the cases I'm familiar with. Perhaps there's something different going on here - the "usual" problem is that Nasm sees "-Ic:\my" and "project\", despite the quotes... (and takes "project\" to be an input file)

One thing you might try is to:

set NASMENV=! -I"c:\my project\"! -O999

or whatever - that causes "!" to be treated as a delimiter, rather than space. See:

A sure fix is to use the true name - "myproj~1" or whatever - instead of file/directory names with spaces in 'em. (does this work with NTFS? works with FAT32) Better yet, don't use spaces in filenames - and especially directory names - in the first place. I know a space is a "valid" character in a filename, but it's also frequently treated as a "delimiter". This often causes problems, not just for Nasm. I guess they're okay in a GUI, but from the command line you've got the "hassle" of typing the quotes every time... at least. I'd avoid 'em!



  • Guest
Re: about -I switch
« Reply #2 on: March 19, 2005, 10:00:17 AM »
It's clear now where the problem is..
I thought that nasm has some code dealing with OS particularities (specifically the file operations), but the doc states that it doesn't, so when the search path (-i's argument), which includes the quotes, is appended with the file name when the include file needs to be open, the result is an invalid path.. and because the output file and input file parameters aren't touched, Windows understand them..
And this was bugging me, one quoted path worked, and the other don't..
The error from nasm is indeed "no input file specified", and all file/directory names are without spaces in them (that "c:\my project" was just an example)... the idea is that i'm calling nasm from "visual c++" which appends quotes to every path, no matter if there are spaces in file/directory names or not... the workaround is that i have to manually edit the project file to delete those quotes for the -i's argument, which is frustrating..
ehh.. i'll work a little extra to script that.. also I will try the NASMENV variable to see how it goes..
Thanks a lot Frank for your replay!


  • Guest
Re: about -I switch
« Reply #3 on: March 19, 2005, 04:48:57 PM »
Yes, double quotes are handled by the OS
or shell under which you're running NASM.
That is, the OS or shell hands a string
to NASM, which contains the whitespaces,
but no longer contains double quotes. (In
other words: NASM isn't stripping those
double quotes -- it takes whatever string
it gets it from the OS or shell -- as is.)

And no, NASM won't traverse the -I paths
when it is looking for your input file.
That is

nasm -I some_path some_file

won't look for some_file in some_path if
some_file isn't in the current directory.
Only include files traverse those paths.