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 / One strange error , but there is no error in the code

Author
Message
Takis76
21
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 6th Jan 2011 12:33 Edited at: 6th Jan 2011 12:34
Hi my friends ,

:o) I have a little strange error , but there is no error in the code.




The code above is correct but when I compile , I am taking a
Declaration is not valid at line 5

I don't have an error , I just call the type initialize from a function.

assume the string <----- THE ERROR INDICATES HERE IN COMPILER is not exist in the code , I just put it here to indicate where the error highlights.

Where is the problem? is this a bug?
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 6th Jan 2011 12:43
Help file says UDT's must be declared at the begin of your code.
not inside a function
soadjason
21
Years of Service
User Offline
Joined: 8th Apr 2005
Location:
Posted: 6th Jan 2011 12:43
You can't declare a type inside a function.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th Jan 2011 14:19
If you want to do something like that, best to make a sub-routine anyway. Functions should be reserved for things where a segment of code requires a dynamic variable or performs a task to return a specific value.

"Only the educated are free" ~Epictetus
"Imagination is more important than knowledge..." ~Einstein
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 6th Jan 2011 14:41
You need to check what's functions are used for and what's not good or fit for.Then you aren't gonna have stupid errors like this.I recommend reading some tutorials, clearing stuff and etc.Best regards!

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Takis76
21
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 6th Jan 2011 16:01 Edited at: 6th Jan 2011 16:01
If I use #include command ,on top of my program , I will able to initialize global types for my game without need to call a function.



Thank you very much....
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 7th Jan 2011 00:06
BTW, if your code doesn't compile, it usually means you have errors,
so it's best not to say you have no errors.
Good Luck
Mugen Wizardry
User Banned
Posted: 7th Jan 2011 00:17
use "waitkey" once above, and once under the code you think is messed up.

BEST idea would be to download the Indigo IDE.

It PAWNS the dbpro editor

http://indigo.mapmasterz.com/downloads/

If the above doesn't allow you to download it, click:

http://indigo.mapmasterz.com/downloads/Indigo_v112_Beta_Installer.zip <~~~~ there

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Takis76
21
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 27th Jan 2011 01:05
@Mugen Wizardry
Thank you for the new IDE , I will try it.

@BillR
My code doesn't have errors. I will try and the other option to put all my source code in one huge single file.

It have to be , about . I am using separate files...
For example . all variables and types , are in separate file and might the compiler doesn't recognize them.

But is not good idea to have one single huge source code file...

Login to post a reply

Server time is: 2026-07-16 12:19:54
Your offset time is: 2026-07-16 12:19:54