Author Topic: How to set include folders  (Read 16761 times)

Offline iVision

  • Jr. Member
  • *
  • Posts: 22
How to set include folders
« on: July 24, 2013, 04:56:42 PM »
Hello, sorry ignore the previous text that was here :P
How do I set an include path for nasm? And (to me its a bug) why does the cmd prompt needs to be in that folder, otherwise include doesn't work:

Files:
path\Server\socket.asm
path\Server\main.asm

Code: [Select]
path> nasm -f win32 Server\main.asmIt will fail that it cannot find %include "socket.asm"

But the main thing, how to set a include path?

Regards

« Last Edit: July 24, 2013, 05:27:34 PM by iVision »

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: warning initialize memory in .bss
« Reply #1 on: July 24, 2013, 05:11:37 PM »
Try this ( note the squared brackets around the section ):

Code: [Select]
[section .bss]
emptyArray: resb 10

Offline iVision

  • Jr. Member
  • *
  • Posts: 22
Re: warning initialize memory in .bss
« Reply #2 on: July 24, 2013, 05:24:10 PM »
Just noticed its my bad, compiled the wrong file.. Anyway I have another problem, so Ill edit the main thread..

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: warning initialize memory in .bss
« Reply #3 on: July 24, 2013, 05:25:59 PM »
My understanding of the difference between "[section .bss]" and "section .bss" is that the latter is a macro which besides producing "[section .bss]" sets the "__SECT__" macro. It "shouldn't" make any difference besides that. I'd be looking at what comes after the code you posted. Do you switch to some section that allows initialized data before trying to initialize data (or code)? What you show looks "right" to me, so I suspect the problem is in something you don't show...

Best,
Frank


Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: How to set include folders
« Reply #4 on: July 24, 2013, 05:45:55 PM »
Heh! Okay, ignore previous answers.

Code: [Select]
path> nasm -f win32 Server\main.asm -i Server\
(note that the trailing backslash is mandatory!)

In its zeal to be "OS-agnostic", Nasm doesn't do very well in following you around from directory to directory. The easiest thing may be to specify the complete path to the include file...
Code: [Select]
%include "C:\path\Server\socket.asm"
... or whatever is appropriate.

Best,
Frank


Offline iVision

  • Jr. Member
  • *
  • Posts: 22
Re: How to set include folders
« Reply #5 on: July 24, 2013, 06:46:47 PM »
Heh! Okay, ignore previous answers.

Code: [Select]
path> nasm -f win32 Server\main.asm -i Server\
(note that the trailing backslash is mandatory!)

In its zeal to be "OS-agnostic", Nasm doesn't do very well in following you around from directory to directory. The easiest thing may be to specify the complete path to the include file...
Code: [Select]
%include "C:\path\Server\socket.asm"
... or whatever is appropriate.

Best,
Frank

Okay too bad, is it possible to set includes? I mean I haven't find any settings file, why isn't it there? It would be nice if you could add C:\nasm\inc so that you can use %include "somefile.inc" instead of %include "C:\nasm\inc\somefile.inc"

Would be a really nice feature!  But I guess I have to stick with full paths or nasm -i flag
Regards

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: How to set include folders
« Reply #6 on: July 24, 2013, 07:43:33 PM »
set NASMENV=-IC:\nasm\inc\


Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: How to set include folders
« Reply #7 on: July 24, 2013, 08:11:01 PM »
As Rob says, NASMENV is probably your best bet. Nasm does not (and probably never will) depend on any external file for its functioning.

Best,
Frank