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 Discussion / #include problem... I think O.o

Author
Message
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 00:57
So according to #include command help in the help files, I can have up to 255 #includes... so how come when I have the following in my code;

#include "login.dba"
#include "logout.dba"

Does it tell me I have an EndFunction command where no function was declared? Both are syntaxed correctly and the functions are different names. Also, the filenames are correct and I don't have any spaces before the #include. The #include commands are at the top of my prog.

It's wierd because if i take out the second #include command then it works fine.

is it me or did the darkbasic help lie.. again...?
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Jul 2009 01:25
Welcome to the forums!

check in "logout.dba" for the following things:

1) Does it compile correctly? (f4)
2) Do you have a function in a function?
3) Check if you didn't forget the endfunction after a function call.

TheComet


Make the path of your enemies easier with Waypoint Pro!
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 01:33
I checked all those things and nope, everything is correct. I also did a second test.

I copied the entire contents of login.dat and pasted it over logout.dat

so now both are the same

I then changed the function name in logout.dat to some random letters. at this point i'm not calling functions, just trying to get the #include to load them.

so i have login.dat having function login(user$,pass$) and logout.dat having function fdsfdas(user$,pass$)

I still get the same issue

I just wrote a test program, very simple, and it shows what i'm trying to do and gives the same error. please see the atachment

Attachments

Login to view attachments
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 01:37
further testing of the program I attached above, If i comment out the #includes and just f4 compile the functions inside the main prog it compiles successfully, so it's not me lol....
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Jul 2009 01:43
sorry, but for some very weird reason I cannot open the main program... Mind posting the code in a
of the file "test.dba"?

thanks, TheComet


Make the path of your enemies easier with Waypoint Pro!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Jul 2009 01:56
I know that filenames with #include tend to be kinda tempermental. Try abbreviating the logout filename to a shorter one and see if it fixes it.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 01:58 Edited at: 23rd Jul 2009 02:00
test.dba


login.dat


logout.dat



From what I've read off posts, the help files... that should compile but it won't.

This compiles just fine tho

newtest.dba


I just don't get it lol
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 02:07
@BN2 Productions

I renamed the files and references to them to a I.dat for login and O.dat for logout. Still no go, the first #include works but it hits the second #include then fails.

keeps saying Syntax Error: EndFunction used without Function declaration.
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Jul 2009 02:08
The newtest.dba will cause a "runtime error! program ran into a function declaration". ALWAYS put your functions at the end of your code.

Try changing the extensions from ".dat" to ".dba". It sounds silly, and I don't believe it will make a change, but just try. I have no idea why this won't run otherwise...

Oh, have you checked if all of those files are in the same directory?

TheComet


Make the path of your enemies easier with Waypoint Pro!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Jul 2009 02:10
Lol, works fine for me. Just copied and pasted straight from your post. Are the files in the same directory?

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 16:43
@TheComet

Usually I do place functions at the end, but even so in my actual program having functions anywehre ran fine. Just using multiple #include commands doesn't seem to work.

@BN@ Productions

Yep all are in the same directory, no sub-folders. That's extremely odd you copied and pasted and it works for you... but not for me. Means something is probably wrong with my darkbasic, but i dunno what.
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 16:48 Edited at: 23rd Jul 2009 16:55
Ok, another test, I did as suggested and renamed them to .dba. Still won't work.

Here's another test to try both...

Compiles
`#include "login.dba"
#include "logout.dat"

Compiles
#include "login.dba"
`#include "logout.dat"

Doesn't Compile
#include "login.dba"
#include "logout.dat"

it's not the file name, it's not the functions themselves, it's not me... it just isn't working period... only works with 1 #iuclude and that is wierd considering db help says up to 255.
It'd be great if one of the darbasic developers took a look at this post ; ;
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 23rd Jul 2009 16:56
Login? Logout? Sounds(somewhat) Multiplayer.

Hmmmm.......Nomad, Is it that using multiple includes doesn't work, or include altogether?

Quote: "I copied the entire contents of login.dat and pasted it over logout.dat

so now both are the same"


er.......it might be that u are trying to load the same functions from two differant dbas,or dats in ur case. Try makeing them differant, see if it helps.

Also, are you sure .dats can be used? Darkbasic is very picky when it comes to certain filetypes.......

Your signature has been erased by a mod because it was too big.CHANGE IT OR DIE!!!!!
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 18:49
Nah further down in that post i modified the function in the copy. If I use only 1 #include command then any file extension will work. It's when i try to use multiple includes that it will not ocmpile. According to darkbasic help, i am able to use 255 #include commands and that simply is not working.
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 18:53 Edited at: 23rd Jul 2009 19:01
I'm going to simply repost my snippets with .dba extensions, maybe this will clear up confusion about what I am trying to do:

test.dba

login.dba

logout.dba


-All files are in the same directory.
-all extensions are .dba
-each function is a different name
-all functions have an endfunction
-darkbasic help says I can have 255 #include statements

Goin by the above snippets, this should work... but I get Syntax Error:Endfunction where a function was not declared. I'm failing to see why the snippets won't compile. It would be great if an actual darkbasic dev would look here lol.

Oh yea, to factor out my functions being bad... I can have login.dba and logout.dba be empty (nothing in the file) and it still tells me i have an endfunction where no function was declared... If I have no function at all, why tell me I have and endfunction with no function declared? that makes absolutely no sense.... -.-
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Jul 2009 20:01
It works fine for me. What version of DB do you have?

TheComet


Make the path of your enemies easier with Waypoint Pro!
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 23rd Jul 2009 20:29
Yea Works fine for me as well.

Your signature has been erased by a mod because it was too big.CHANGE IT OR DIE!!!!!
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 20:42
I'm using DarkBasic Classic 1.20
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Jul 2009 20:46 Edited at: 23rd Jul 2009 20:46
So you're telling me, that the attached rar file on this post here doesn't work?

TheComet


Make the path of your enemies easier with Waypoint Pro!

Attachments

Login to view attachments
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 21:51
For me, nope, but seems for everyone else it does
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Jul 2009 21:59
Try re-installing darkbasic or your latest patch, maybe there it got messed up some how.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 23rd Jul 2009 22:30
You can store more than 1 function in an #included library. Try storing both functions in one file then only include that 1 file. See if you get the error.

And just a note:
#include has to be all the way over to the left margin
and

I got some real wierd #include errors a while ago saying something to the extent of a problem with a function. I don't know how I tracked it down but it was because my last function in the library file didn't have a line feed + carriage return after it. That means at the bottom of the page with the library functions in them



May not be the problem, but it can't hurt.

Enjoy your day.
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 22:37
Ok so I tried reinstalling.

I installed 1.0 and tested it, didn't compile, same error.

I upgraded to 1.13, didn't compile, same error.

I upgraded to 1.20, didn't compile, same error.

I'm beginning to think darkbasic fails... I don't have anything left to try.
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 22:38 Edited at: 23rd Jul 2009 22:39
Yea i already know it works with multiple functions in one include, I just wanted to utilize more includes to break it down, seperate files for seperate functions... like actual sub routines.

But the fact still remains, darkbasic says I can have up to 255 includes... why won't it work?

I shot an email with the problem to technical support, still waiting on a reply tho.
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 22:40 Edited at: 23rd Jul 2009 22:41
Ok, new test lol.

#include "login.dba"
#include "logout.dba"

WORKS only if one of the 2 files doesn't exist O.o wtf... defeats the purpose
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 23rd Jul 2009 22:43
please dont post mutiple times together, this is known as double or triple posting

if you have more to add please press the "edit post" button at the bottom left of a post

Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 22:45 Edited at: 23rd Jul 2009 22:46
Fine, but why waste a post here? You haven't contributed to this post, but appear form no where to warn me about double posting in my own topic?

how rude.

EDIT: I double posted in order to break up my tests, results, and information. in hope to have it laid out better.
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 23rd Jul 2009 22:52
excuse me for enforcing the rules here, and about you breaking up the info, you can type edit: between edits to organize

and where do you get off saying that I cant post here becuase i havent contributed? THIS IS A FREE FORUM, YOU DONT TELL ME WHERE I CAN AND CANT POST, ILL POST WEREVR THE HELL I WANT, I DONT GIVE CARE ABOUT WHETHER THE THREAD CREATOR APPROVES OR NOT!!

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Jul 2009 22:56
No bickering please

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 23rd Jul 2009 23:02
how about changing the names to be complete different from each other?

login.dat
puppy.dat

Enjoy your day.
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 23:03 Edited at: 23rd Jul 2009 23:05
No worries, People like that tend to run off people like me. I'm just going to resolve this with technical support from now on. I come here to try to get help and dealing with people such as him really does defeat the purpose of a forum. thanks to BN2 and Conker for your help. I guess that1smart guy is just too smart for me...
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Jul 2009 23:03
Did you try out latch's earlier suggestion about adding an extra line to each?

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 23rd Jul 2009 23:07
>.>

O.O

it works lmao... not sure why it needed a space after each endfunction but it now works. thanks guys.
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 23rd Jul 2009 23:09
Quote: "Conker"

rofl, u mean comet?


also man im sorry, im not usually too rude, i just dont take too nicely to people giving me orders and or showing general disrespect, no hard feelings

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Jul 2009 23:36 Edited at: 24th Jul 2009 01:53
"...so Latch ignores what Smart guy says and carries on on-topic as planned..."

Quote: "and Conker for your help."


Yay, a new nick name! ^^

Glad I could help, even though nothing I suggested worked... Way to go Latch, how on earth did you know to add that new line? Dark Edit does it automatically I just figured out.

TheComet


Make the path of your enemies easier with Waypoint Pro!
Silverman
17
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 23rd Jul 2009 23:41 Edited at: 23rd Jul 2009 23:47
EDIT : Post deleted. I had not seen the answer to latch.

AMD Athlon(tm)XP 3200+ (2.2GHz) / DDR pc3200 (1024Mo) / Nvidia 6800GT (driver 178.24 WHQL)/ XP Pro SP3 / DirectX 9.0c (march 2008)/ DBPro 7.1
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 23rd Jul 2009 23:53
Conkerz............

Your signature has been erased by a mod because it was too big.CHANGE IT OR DIE!!!!!
Nomad The Great
16
Years of Service
User Offline
Joined: 18th Apr 2008
Location:
Posted: 25th Jul 2009 17:22
I'm sorry also that1smartguy, was frustrated by such a silly thing lol.

@TheComet lol not sure why i put conker, must've saw the avatar and did it automatically, too funny.

Login to post a reply

Server time is: 2024-05-20 06:16:03
Your offset time is: 2024-05-20 06:16:03