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 / Compiler Crashing?

Author
Message
Kaezon
15
Years of Service
User Offline
Joined: 15th Dec 2010
Location: West Point, NY
Posted: 16th Dec 2010 05:47
Hey, so I defined some functions to create some custom types I've defined (2dVector and 2dButton). I've tested create2dVector() and it works out fine, but when I attempt to use create2dButton, the compiler crashes when I attempt to compile my program.

Main.dba


2D_Library.dba


Menu_Library.dba
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Dec 2010 14:21
It could be due to the IDE combining the files in the wrong order, but as I don't have a compiler handy with me at the moment, and because you have neglected to post any indication of the error message you get, then all I can do is guess

Kaezon
15
Years of Service
User Offline
Joined: 15th Dec 2010
Location: West Point, NY
Posted: 16th Dec 2010 19:02
Well, I wasn't getting an error, just a crash report from Windows; however, I just restarted my computer to get a few updates and when I reopened my project it was working just fine.

I noticed that my code files have rearranged themselves in the compiler so I can only guess that what you said was correct. Something about the order was screwing with the compiler.

Thanks for your help
Kaezon
15
Years of Service
User Offline
Joined: 15th Dec 2010
Location: West Point, NY
Posted: 16th Dec 2010 21:09
No wait, my mistake, I forgot to un-REM the line that's causing the crash.

This is the line that's causing the problem.


Here's the crash report, if it's of any help.
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 16th Dec 2010 22:42
Try declaring the variable and assigning it a value on different lines?

Kaezon
15
Years of Service
User Offline
Joined: 15th Dec 2010
Location: West Point, NY
Posted: 17th Dec 2010 04:31
I just tried that, no effect.
However, I separated the create2dVector functions and made them into variables of type 2dVector and I got the error "Both user defined type values must use the same type at line 39."

Here's my edited MainMenu subroutine.
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 17th Dec 2010 09:59 Edited at: 17th Dec 2010 10:08
I've never seen this done before.



Should it not be



>Edit<

Whether it should be like that or not I dunno, lol, but it doesn't seem to be causing your problem.

My other concern about your code is where you have...



I'm not sure you can declare a variable as a type and then pass it in a function like that.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 17th Dec 2010 14:10 Edited at: 17th Dec 2010 14:13
Quote: "
function create2dVector(posX,posY)
newVector as 2dVector
newVector.X = posX
newVector.Y = posY
ENDFUNCTION newVector
"


Yeah, that wouldn't work. You can't pass UDT's out of functions, but you can in, so: create2dVector( newVector as 2dVector ).

For this you just make a global passing variable, for instance in my vector class and every other class:



A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.

Login to post a reply

Server time is: 2026-07-21 07:03:22
Your offset time is: 2026-07-21 07:03:22