Author Topic: Nasm in visual studio: spaces in file path  (Read 18408 times)

nobody

  • Guest
Nasm in visual studio: spaces in file path
« on: September 23, 2009, 10:09:39 AM »
I'm trying to use NASM in Visual Studio. I keep getting the following error:
"error: more than one input file specified".

Visual Studio calls Nasm using the following command:
nasm -f win32 --prefix _ -DWIN32 -I "c:\Documents and Settings\mypath\" -o "release-smd\myfile.obj" "c:\Documents and Settings\mypath\myfile.vcproj"

I am not very experimented with the windows command line, so I've made several attempts, adding and removing slashes and double quotes, and I've used google extensively with no result (others are having the same problem, but I couldn't find a solution).

Is it even possible to feed nasm a filepath which includes spaces?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Nasm in visual studio: spaces in file path
« Reply #1 on: September 23, 2009, 01:28:56 PM »
Well... last time I used Windows it was win98, which used a FAT32 file system. I ASSume everything is NTFS these days. The easiest way I found (other than just not using spaces in file/path names) was to use the "short name" (the "true name" in FAT32) "Docume~1" or so. I ASSume this will still work. Enclosing the name in quotes as you've done "should" work, but... it's an imperfect world.

Nasm provides a "trick", if you use the NASMENV environment variable. If the variable starts with a character other than "-", that character, rather than "space" is considered the "delimiter" - so "set NASMENV # -ic:\Documents and Settings\mypath\ #--prefix _ #-DWIN32 #... etc" (I'd add "-Ox" to turn on "optimization", too). See:

http://www.nasm.us/doc/nasmdoc2.html#section-2.1.28

(I just noticed an error in the documentation: The "-i" search path should end with "\"! You've got it right.)

That would solve part of your problem, but not all. (probably wouldn't want the input file name in an environment variable).

I think using "Docume~1" is easiest, and I think it'll still work...

Congratulations on diagnosing the problem correctly!

Best,

Frank

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Nasm in visual studio: spaces in file path
« Reply #2 on: September 25, 2009, 03:05:59 AM »
Update to "using Nasm with VS".

Henry Tumblin has graciously contributed his "nasm.rules" file for VS, and - better yet - a README on how to use it. Looks to me like this will save people wanting to use Nasm with VS a *lot* of time and trouble! Available in the "Contributions" section of the download page here, or at:

http://home.myfairpoint.net/fbkotler/nasmVS.zip

Soon to be available at http://www.nasm.us

Thanks, Henry!

Best,
Frank