Sign in to follow this  
Followers 0
Quasar Jarosz

#include-once being ignored

5 posts in this topic

Has anyone encountered a situation where #include-once seems to be ignored?

I have a script that #include's File A and File B, and File A include's File B (becuase of course File A depends on File :whistle:.. however, once this happens a few times (ie, Files A, B, C, and D all #include File Z) i begin to get "duplicate function def" errors.

Has anyone seen anything like this? Or is it a known issue at any point?

I have been solving it by just removing the #include from the main script if one of it's dependant files already includes it.. but, i assumed #include-once would allow me to try to include it as often as i want?

I'll try to build a simple example to illustrate this if anyone would like..

Thanks!

Share this post


Link to post
Share on other sites



Can you post a small example to show the problem?


Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

Can you post a small example to show the problem?

Alright, i figured out what the problem was when i tried to recreate it.

What i had was this..

In one file:

#include <Misc\Beep.au3>

And in another:

#include "..\..\..\..\lib\Misc\Beep.au3"

The lib path is set in the registry as one of the paths to search for included files.

So, it's the same file, but it's been refered to two different ways, and that seems to be the source fo the problems.

I don't know if this is the intended behavior or not, but it doesn't look like a major issue.

Share this post


Link to post
Share on other sites

The fully expanded path is used to enforce #include-once. It doesn't matter how you specify the file, if it's really the same file, it will only be included once. So you still need to provide a way to reproduce the problem because the way you describe does not reproduce it.

Share this post


Link to post
Share on other sites

he is saying that its working now , so i think he's right :whistle:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0