flat assembler
Message board for the users of flat assembler.

Index > Main > 'Include' directive cannot be the same name as the containin

Author
Thread Post new topic Reply to topic
jiangfasm



Joined: 08 Mar 2015
Posts: 60
jiangfasm 11 Sep 2015, 05:19
jack@JACK-PC MINGW64 ~
$ cd bugtst/

jack@JACK-PC MINGW64 ~/bugtst
$ find .
.
./tst1
./tst1/val.inc
./tst2
./tst2/val.inc
./tst2/valtst.asm

jack@JACK-PC MINGW64 ~/bugtst
$ cat ./tst1/val.inc
tst1 = 1

jack@JACK-PC MINGW64 ~/bugtst
$ cat ./tst2/val.inc
tst2 = 2

jack@JACK-PC MINGW64 ~/bugtst
$ cat ./tst2/valtst.asm
include 'val.inc'
dd tst1
dd tst2

jack@JACK-PC MINGW64 ~/bugtst
$ cd tst2/

jack@JACK-PC MINGW64 ~/bugtst/tst2
$ export INCLUDE=../tst1

jack@JACK-PC MINGW64 ~/bugtst/tst2
$ fasm valtst.asm
flat assembler version 1.71.39 (1048576 kilobytes memory)
valtst.asm [2]:
dd tst1
error: undefined symbol 'tst1'.

jack@JACK-PC MINGW64 ~/bugtst/tst2
$ mv val.inc val2.inc

jack@JACK-PC MINGW64 ~/bugtst/tst2
$ fasm valtst.asm
flat assembler version 1.71.39 (1048576 kilobytes memory)
valtst.asm [3]:
dd tst2
error: undefined symbol 'tst2'.
Post 11 Sep 2015, 05:19
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20485
Location: In your JS exploiting you and your system
revolution 11 Sep 2015, 05:39
The search for files will always find that file val.inc in the current folder first. If you need to force it to find another file with the same name then use an explicit path:
Code:
include '..\tst1\val.inc'    
Post 11 Sep 2015, 05:39
View user's profile Send private message Visit poster's website Reply with quote
jiangfasm



Joined: 08 Mar 2015
Posts: 60
jiangfasm 11 Sep 2015, 05:51
revolution wrote:
The search for files will always find that file val.inc in the current folder first. If you need to force it to find another file with the same name then use an explicit path:
Code:
include '..\tst1\val.inc'    


I thought you said. But such errors are hidden. I suggest adding some warnings to fasm.
Post 11 Sep 2015, 05:51
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20485
Location: In your JS exploiting you and your system
revolution 11 Sep 2015, 06:09
You have two files of the same name in different folders. I am not sure how fasm can warn you of this.
Post 11 Sep 2015, 06:09
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 11 Sep 2015, 06:11
Well, FASM can't know what are you thinking about and to warn you about wrong thoughts.

You have filename in the "include" directive and FASM, using well defined and documented algorithms, searches for this file and can read one. Right or wrong it depends on you.
Post 11 Sep 2015, 06:11
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
jiangfasm



Joined: 08 Mar 2015
Posts: 60
jiangfasm 11 Sep 2015, 08:33
That makes sense! I FASM program levels and improve!
Post 11 Sep 2015, 08:33
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.