FBC Compiler error

The forum for all of your Freebasic needs!

Moderators: Pete, Mods

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

FBC Compiler error

Postby Mentat » Tue Jan 27, 2009 1:14 pm

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 . . .

User avatar
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Postby Nodtveidt » Tue Jan 27, 2009 5:48 pm

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

Postby Mentat » Tue Jan 27, 2009 5:54 pm

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 . . .

User avatar
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Postby Nodtveidt » Tue Jan 27, 2009 6:10 pm

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: 2143
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

No wonder FB sucks.

Postby burger2227 » Tue Jan 27, 2009 6:16 pm

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 : http://www.QB64.NET
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.

Postby Mentat » Tue Jan 27, 2009 6:31 pm

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:

Postby Imortis » Tue Jan 27, 2009 8:59 pm

@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


Return to “Freebasic Questions & Answers”

Who is online

Users browsing this forum: No registered users and 2 guests