SImplify Posted September 10, 2004 Share Posted September 10, 2004 Hi there, Quick question. I have three files. main.au3 main_functions.au3 functions.au3 In the top of main.au3 I have #include "main_functions.au3" #include "functions.au3" Now I will need to call one_function (=functions.au3) also in file main_functions.au3 but I have not succeed to do that. I have #include-once statement in functions.au3 and main_functions.au3 and then I try to add #include "functions.au3" in main_function.au3 I got error message -> ERROR: one_function() already defined. Can you help me? Cheers Simplify Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted September 10, 2004 Share Posted September 10, 2004 I am having trouble following the scenario, could you post your code or an example that does the same things? *** Matt @ MPCS Link to comment Share on other sites More sharing options...
SImplify Posted September 10, 2004 Author Share Posted September 10, 2004 ;main.au3 #include "functions.au3" #include "main_functions.au3" ..... logi() ;works fine ------------------ ;functions.au3 #include-once func logi() ;write some log endfunc ------------------ ;main_functions ;How can I call function logi() here? ;like below func some() logi() endfunc By including functions.au3 in main_functions file I got error message: ERROR: logi() already defined. Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted September 10, 2004 Share Posted September 10, 2004 (edited) Are the two logi functions identical? Could you copy and paste the exact error syntax into the forum? *** Matt @ MPCS Edited September 10, 2004 by Matt @ MPCS Link to comment Share on other sites More sharing options...
SImplify Posted September 10, 2004 Author Share Posted September 10, 2004 Are the two logi functions identical? Could you copy and paste the exact error syntax into the forum? *** Matt @ MPCS <{POST_SNAPBACK}>There are only one logi function (in functions.au3) and I would like to call that function both in main.au3 and main_functions.au3. If I put #include "functions.au3" in top of functions_main.au3 file the exact error message are: ERROR: function log() already defined. Cheers Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted September 10, 2004 Share Posted September 10, 2004 Why do you need #include-once in functions.au3? That is the problem. What I am unsure of is if you include functions.au3 in main_functions.au3, and then include main_functions.au3 in main.au3, will main.au3 have the ability to call functions from functions.au3? Graphically: If main.au3 > includes > main_functions.au3 > which includes > functions.au3 can main.au3 > access functions in-----------------------------------------^ ? *** Matt @ MPCS Link to comment Share on other sites More sharing options...
SImplify Posted September 10, 2004 Author Share Posted September 10, 2004 Why do you need #include-once in functions.au3? That is the problem. What I am unsure of is if you include functions.au3 in main_functions.au3, and then include main_functions.au3 in main.au3, will main.au3 have the ability to call functions from functions.au3? Graphically: If main.au3 > includes > main_functions.au3 > which includes > functions.au3 can main.au3 > access functions in-----------------------------------------^ ? *** Matt @ MPCS <{POST_SNAPBACK}>BIG Thxs! Now it works! What I thought was, that you can include whatever whereever if you had that #include-once statements in included files. Cheers Simplify Link to comment Share on other sites More sharing options...
Administrators Jon Posted September 10, 2004 Administrators Share Posted September 10, 2004 (edited) ;main.au3 #include "functions.au3" #include "main_functions.au3" ..... logi() ;works fine ------------------ ;functions.au3 #include-once func logi() ;write some log endfunc ------------------ ;main_functions ;How can I call function logi() here? ;like below func some() logi() endfunc By including functions.au3 in main_functions file I got error message: ERROR: logi() already defined. If i add '#include "functions.au3" ' to main_functions.au3 it still works OK for me. Are you sure you've not got another definition of logi() somewhere. Edited September 10, 2004 by Jon Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Developers Jos Posted September 10, 2004 Developers Share Posted September 10, 2004 If i add '#include "functions.au3" ' to main_functions.au3 it still works OK for me. Are you sure you've not got another definition of logi() somewhere. <{POST_SNAPBACK}>try this to see it fail with: ....main_functions.au3 (5) : ==> Duplicate function name.: func some() ;main.au3 #include-once #include "main_functions.au3" #include "functions.au3" logi() ;functions.au3 #include-once #include "main_functions.au3" func logi() ;write some log endfunc;main_functions ;How can I call function logi() here? ;like below func some() logi() endfunc SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Administrators Jon Posted September 10, 2004 Administrators Share Posted September 10, 2004 try this to see it fail with: ....main_functions.au3 (5) : ==> Duplicate function name.: func some() ;main.au3 #include-once #include "main_functions.au3" #include "functions.au3" logi() ;functions.au3 #include-once #include "main_functions.au3" func logi() ;write some log endfunc;main_functions ;How can I call function logi() here? ;like below func some() logi() endfunc Well that's fair enough, main_functions.au3 doesn't have an #include-once. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
ezzetabi Posted September 10, 2004 Share Posted September 10, 2004 Or you can just copy and past the funcs you need in the botton of your script. Link to comment Share on other sites More sharing options...
SImplify Posted September 10, 2004 Author Share Posted September 10, 2004 If i add '#include "functions.au3" ' to main_functions.au3 it still works OK for me. Are you sure you've not got another definition of logi() somewhere.That's how it works for me too...Cheers Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now