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.

Bug Reports / Compile Failure @ Unexistant line

Author
Message
Orochium
11
Years of Service
User Offline
Joined: 21st Dec 2012
Location: Steamboat Springs, CO
Posted: 21st Dec 2012 21:34
Howdy folks, not sure if this is a bug or what, but was wondering if anyone else had this issue, but I was hacking together some code and ran into a strange issue.

I am at work so I can't post the code snippit yet, but basically whenever I try to code using a function in an #INCLUDE file, compiling fails, complaining that the 'function is duplicated' in the #INCLUDE file.

In this case, I have an include called menupart.dba, the code at the top of the main program project is:

#INCLUDE menupart.dba

Then in menupart DBA I have a function named 'Button' which was originally in the main body of the project code, but was moved out to the separate menupart.dba file.

It does this arbitrarily (i.e., it works occasionally, but fails most of the time), it complains that "Function 'Button' is duplicated in menupart.dba" at line 72.

The problem is, the main body of code only goes to line 54

menupart.dba's codebase starts at 1.

So why it's failing at line 72 is a mystery. In addition to this, the only place the "Button" function appears is on line 1 of menupart.dba, and then used in some IF statements where the button and its clicks are called in the main body, but nothing is overlapping the definition of the "Button" function in the main body of code.

...the heck is going on with this thing? Anyone have any ideas?

System Information:

DarkBASIC Professional v.7.62
Windows 7 Home Premium

Intel Core i3-2105
Corsair 8GB GDDR3
Zotac Mini-ITX Z68 Backplane
Gigabyte GeForce GT 560 Ti 1024MB PCI-E

Dead Teddy Studios, LLC.
Orochium
11
Years of Service
User Offline
Joined: 21st Dec 2012
Location: Steamboat Springs, CO
Posted: 22nd Dec 2012 02:36
Home now, here is the source I'm using

RPG_TUTORIAL.DBA



And the include:

MENUPART.DBA



Dead Teddy Studios, LLC.
Orochium
11
Years of Service
User Offline
Joined: 21st Dec 2012
Location: Steamboat Springs, CO
Posted: 23rd Dec 2012 04:23
WHOA. Okay, I figured it out.

If you add an INCLUDE'd file to DarkBASIC Pro via the Open/File...(Add to project) menu item, it's AUTO INCLUDED meaning you don't need a static line like this:

#INCLUDE menupart.dba

Because then it tries to include the file twice. Either just do an #INCLUDE from the same directory, or use Open/File...(Add to project) just not both.

I didn't see that in the help file anywhere, so I'm glad I figured it out. Not sure if its a bug or not, but I'll leave this here or allow you to move it for posterity.

PS: If anyone saw it, I fixed:

[Code]IF button(20,55,"New Game")=1 GOTO New_Game

to properly read:

IF button(20,55,"New Game")=1 THEN GOTO New_Game

Sorry for any trouble

Dead Teddy Studios, LLC.

Login to post a reply

Server time is: 2024-04-26 07:14:26
Your offset time is: 2024-04-26 07:14:26