FBC Compiler error

The forum for all of your Freebasic needs!

Moderators: Pete, Mods

Post Reply
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

FBC Compiler error

Post by Mentat »

I got an error message "Aborting due to runtime error 12 ("segmentation violation" signal)" when I tried to compile something. It didn't give a line number or anything, it just says that. What does it mean? Is the code I'm trying to compile bringing up the error, or is the compiler itself having the error?
For any grievances posted above, I blame whoever is in charge . . .
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt »

That's an error in the compiler itself. It means the compiler is trying to access memory it doesn't have access to, and it's bailing. Likely a buffer error.
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Post by Mentat »

It went away after I fixed some syntax errors. I was typing => instead of ->. Still, that was odd since the compiler didn't flag that as an error.
For any grievances posted above, I blame whoever is in charge . . .
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt »

Still, you might want to send the source causing that problem to the devs. It could be indicative of a legitimate problem with the compiler.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

No wonder FB sucks.

Post by burger2227 »

QB uses >=. FB uses -> ? That don't sound right :wink:
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Re: No wonder FB sucks.

Post by Mentat »

burger2227 wrote:QB uses >=. FB uses -> ? That don't sound right :wink:
I used it like this

Code: Select all

const packSize as integer = 5

type dog
 dim age as integer
end type

dim pack(1 to packSize) as dog
dim oldest as dog ptr

'... blah blah blah, do stuff with dogs' ages

'Find oldest dog in pack
oldest = @pack(1)
for i as integer = 2 to packSize
 'compare age
 if oldest=>age < pack(i) then oldest = @pack(i)
next i

end 
For any grievances posted above, I blame whoever is in charge . . .
User avatar
Imortis
Veteran
Posts: 71
Joined: Fri Nov 18, 2005 8:44 am
Contact:

Post by Imortis »

@Clippy:
-> is the pointer dereference operator.
Like the period is used to access the parts of a type.
If you are accessing the points of a type ptr, then you use ->

Code: Select all

Type test
     a as integer
end type

dim variable as test
dim variable_ptr as test ptr

'@ means Address of
variable_ptr = @variable

variable.a = 4

print variable_ptr->a
Image
Post Reply