Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Functions from other project files not recognized.

Author
Message
CDragon
14
Years of Service
User Offline
Joined: 16th Sep 2011
Location:
Posted: 18th Jun 2014 23:16
Hi all, first time posting in a while as I brush off the dust from one of my favorite projects. Anyway, I cannot in the present or the past, after much experimenting get my main program file to call a function in an included file. I have tried #include "myfile.dba", adding and associating files in the Old, New, Indigo, and CodeSurge IDE's. Would someone be willing to submit a working project that has some simple includes for me to study? I would submit my project (a 2d rpg inspired by the old greats and the new, Dark Souls P, but its kinda huge and messy :/ Thus, why I really wanna include some of my many functions in convenient external files.

RAWWWR
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Jun 2014 20:00
You could probably do some simple testing yourself. Just write a main.dba file which simply calls a simple short function contained in an included file. If that doesn't work why not post that project and we can see what went wrong ourselves and hopefully give you further advice.

No need to post the original large project yet.



Powered by Free Banners
CDragon
14
Years of Service
User Offline
Joined: 16th Sep 2011
Location:
Posted: 20th Jun 2014 21:46
Indeed thank you for your response, I just got back to my computer so I'll get started on that sample.

RAWWWR
CDragon
14
Years of Service
User Offline
Joined: 16th Sep 2011
Location:
Posted: 20th Jun 2014 22:37 Edited at: 22nd Jun 2014 03:36
I have some good news, and some interesting things learned as well.

Taking my sample program as an example, I learned that to include external functions, I needed to both append END after the main portion of my code, before the functions, and also have a function defined in the main file. If I did not include a function in my main file, I got syntax errors.

Also, I was able to make my other code work, but in doing so I noticed that I was getting the duplicate function error. I assumed this was caused by having #include statements (instead of letting the editor handle it), but to my surprise, they were all commented out anyway. So, I decided to just remove those lines for good measure, and finally my program was running!!! Very strange, but I thought I'd share Btw, the lines I removed were using the // comment, so I'm not sure if this behavior applies to REM.

RAWWWR

Login to post a reply

Server time is: 2026-07-06 13:34:07
Your offset time is: 2026-07-06 13:34:07