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 / Type Definition Error

Author
Message
Nateholio
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: I\'ve Been Everywhere
Posted: 26th Apr 2012 05:22 Edited at: 26th Apr 2012 05:30
Another problem which I'm sure is because I'm doing something dumb yet not seeing it in the code.

I do this:



And I get "declaration is not valid at line 1" when I try to compile. Thanks for the help!

Edit: Ah, and Float3 is already defined and works just fine in other type defs. Also using the old IDE and this is the first time (with this project) that I've had this error...not gonna downgrade to the new editors either.

In Development: K96 - Combat Simulation
tiresius
23
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 26th Apr 2012 08:23
What exactly is a "Float3" ? Is it another defined type of yours? I ask because that is not a standard type. So order of definition is important and is a single pass as far as I know. So put this definition after your "type Float3 .... endtype" code.


A 3D marble platformer using Newton physics.
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 26th Apr 2012 08:45
temp=make vector3(1)
set vector3 1,x,y,z

one and only way
Nateholio
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: I\'ve Been Everywhere
Posted: 26th Apr 2012 14:48
Float3 is another type already defined and works just fine in other type defs before and after this one here which is giving me problems. It's just three floats named X, Y, and Z.

In Development: K96 - Combat Simulation
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 26th Apr 2012 15:40
Can you give us some code we can actually compile that demonstrates the problem? I'd suggest commenting out each line of the UDT in turn and trying a different name as well to track down what is actually causing the error.

[b]
tiresius
23
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 26th Apr 2012 16:30
Diggsey, I kind of did this already, and the only line giving the problem is "Position as Float3", which is kind of amusing its validity was defended twice already by the submitter.

I didn't try making another type called "Float3" though, and moving it around though to prove it.

Quote: "and works just fine in other type defs before and after this one here which is giving me problems"

How is this possible when the message you are getting is "declaration is not valid at line 1".

Are you using #include or the IDE to clump source files together?


A 3D marble platformer using Newton physics.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 26th Apr 2012 16:57
Some of your variable names are also part of the command instructions and may clash. Try renaming the variable names.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 26th Apr 2012 20:18 Edited at: 26th Apr 2012 20:19
Quote: "Diggsey, I kind of did this already, and the only line giving the problem is "Position as Float3", which is kind of amusing its validity was defended twice already by the submitter.
"


OK, I added a declaration for Float3 and the code compiles fine, which is why I asked for some code which would reproduce the error:




[b]
Nateholio
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: I\'ve Been Everywhere
Posted: 27th Apr 2012 02:09 Edited at: 27th Apr 2012 02:10
Quote: "How is this possible when the message you are getting is "declaration is not valid at line 1""

Perhaps it's possible when someone removes trouble code and tries to compile it separately from the rest of the code that has been shown to work? I dunno, just a guess.

I'm using the IDE to clump everything together, not includes.

@Diggsey
Thanks. I've tried different names, commenting out things, moving the typedef around, even copying to notepad then saving then reopening. Still an error. This wouldn't be a pressing problem (maybe it's just an IDE only error) if I didn't need to use the type (obviously). It compiles, throws an error, then runs fine as long as I comment out the dim statements which use the HUD type later on. But as soon as I add those DIM statements it reverts back to the typedef error and won't compile. I remember running into a similar problem years ago, but its been so long that I don't remember the cause/solution.



Try to compile with the "HUD" type defs not commented out, then retry with them commented out. What should happen is that it will be "kind of amusing" when the code compiles fine w/o the HUD type defs, yet throws an error with them (for tiresius' ease of recognition, this time it should say "Declaration is not valid at line 82."). Maybe it won't throw an error for you either way, which would be odd.

In Development: K96 - Combat Simulation
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 27th Apr 2012 02:44
That's because you're using a type "Float3" when its actual name is "Float_3". If you change that it compiles fine.

[b]
Nateholio
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: I\'ve Been Everywhere
Posted: 27th Apr 2012 02:45
Ah, thanks! I knew I was doing something dumb here. Just didn't see it after looking at it.

In Development: K96 - Combat Simulation

Login to post a reply

Server time is: 2026-07-10 18:11:15
Your offset time is: 2026-07-10 18:11:15