LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-13-2007, 04:58 PM   #1
skarland
LQ Newbie
 
Registered: Feb 2007
Distribution: Redhat Fedora 6 (AMD 64 bits and Intel 32 bits)
Posts: 3

Rep: Reputation: 0
Segmentation Fault and Gcc compiler


Hi friends,
I am new to linux.
I am trying to compile a C program (MEEP) using Gcc (ver 4.1.1) under Fedora 6 (IA32). The compile went OK. But when I run ./*.out file, there comes the "Segmentation Fault".
Is that caused by Gcc version? Can it fixed by installing lower version Gcc?
I searched for this error. It sugguests the error might comes from hardware. That the program is trying to access invalid memory address.
Right now I am trying to install lower version Gcc. But I got errors below when I run "make".

"gcc-3.3.6/gcc/f/com.c:11080: error: conflicting types for ‘ffecom_gfrt_basictype’“
"gcc-3.3.6/gcc/f/com.h:236: error: previous declaration of ‘ffecom_gfrt_basictype’ was here"

Thank you.
 
Old 02-13-2007, 05:45 PM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
By far the most common cause of a segmentation fault is a programming error; that is, a bug in the program. The error "comes from" hardware, because it is hardware that detected the error.

Go back to what you were doing before. Don't try to replace the compiler. Compile your program with the -g switch, which tells the compiler and linker that you'll be using a debugger. Then use gdb to find out where in your program the blowup happens.

Get documentation for gdb here:

http://sourceware.org/gdb/current/onlinedocs/gdb.html

You have a long road ahead of you, but an interesting one.

Hope this helps.
 
Old 02-14-2007, 09:52 AM   #3
skarland
LQ Newbie
 
Registered: Feb 2007
Distribution: Redhat Fedora 6 (AMD 64 bits and Intel 32 bits)
Posts: 3

Original Poster
Rep: Reputation: 0
Hi wjevans,
Thank you!
I just solved this segmentation error by reinstalling MEEP. Because the c++ program is a MEEP tutorial program.
Just don't know why. It just works.
The reinstalling is just like this, instead of the regular install.
make distclean
./configure --enable-debug
make
I got the answer from link
http://comments.gmane.org/gmane.comp...ep.general/659

The current GNU GCC compiler is good. The error comes from MEEP installation.

Quote:
Originally Posted by wjevans_7d1@yahoo.co
By far the most common cause of a segmentation fault is a programming error; that is, a bug in the program. The error "comes from" hardware, because it is hardware that detected the error.

Go back to what you were doing before. Don't try to replace the compiler. Compile your program with the -g switch, which tells the compiler and linker that you'll be using a debugger. Then use gdb to find out where in your program the blowup happens.

Get documentation for gdb here:

http://sourceware.org/gdb/current/onlinedocs/gdb.html

You have a long road ahead of you, but an interesting one.

Hope this helps.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
segmentation fault with g++ compiler aditya1 Programming 3 03-31-2005 03:25 AM
compiling in gcc goes well, gives segmentation fault jshine Programming 6 12-19-2004 01:08 AM
gcc, segmentation fault, though compiles... scratch09 Programming 5 11-20-2004 05:11 PM
internal compiler error: Segmentation fault X2O Mandriva 2 08-23-2004 08:38 PM
gcc / segmentation fault skeletal29 Linux - Software 0 05-05-2002 04:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration