473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Problems trying to compile very simple code

Hi All,

I have three very simple files as below.
When I try and compile these with g++ -ansi -Wall -pedantic -o crap Base.h
Other.h
I get an error:

Base.h:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.htmlfor instructions.
Other.h:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.htmlfor instructions.
make: *** [all] Error 1

Can anyone tell me why? If I remove the #include <iostreamit compiles
without error.

Thanks for your help

Michael

-----------first file--Base.h--------

#ifndef _Base_
#define _Base_

#include <iostream>
class Base {

};

#endif

-------------second file--Other.h-------

#endif

#ifndef _Other_
#define _Other_

#include "Base.h"

class Other {
};

#endif

-------------Third file---crap.cpp-------

int main(){
}

Mar 19 '07 #1
5 1940
Michael wrote:
Hi All,

I have three very simple files as below.
When I try and compile these with g++ -ansi -Wall -pedantic -o crap Base.h
Other.h
I get an error:

Base.h:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.htmlfor instructions.
Other.h:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.htmlfor instructions.
make: *** [all] Error 1

Can anyone tell me why? If I remove the #include <iostreamit compiles
without error.

Thanks for your help

Michael

-----------first file--Base.h--------

#ifndef _Base_
#define _Base_

#include <iostream>
class Base {

};

#endif

-------------second file--Other.h-------

#endif

#ifndef _Other_
#define _Other_

#include "Base.h"

class Other {
};

#endif

-------------Third file---crap.cpp-------

int main(){
}

Probably not the cause of your problem, but your program is ill-formed.
Any identifier with a leading underscore followed by an uppercase
letter (e.g. _Base_ or _Other_) is reserved for use by the
implementation -- you may not use it for your own purposes.

As for the rest, a g++ internal error should be posted in gnu.g++.help,
we don't discuss compiler specifics here.
Mar 19 '07 #2

"Michael" <mi*********@yahoo.comwrote in message
news:45***********************@per-qv1-newsreader-01.iinet.net.au...
Hi All,

I have three very simple files as below.
When I try and compile these with g++ -ansi -Wall -pedantic -o crap Base.h
Other.h
Why are you trying to compile a header? You compile code (.cpp) files, not
code files.

I don't use g++ but with your sample line I think you should be doing:
g++ -ansi -Wall -pedantic -o crap crap.cpp

crap.cpp itself will pull in the headers IF you use include statments. That
is, change crap.cpp to be:

#include "Base.h"
#include "Other.h"

int main()
{
}
I get an error:

Base.h:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.htmlfor instructions.
Other.h:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.htmlfor instructions.
make: *** [all] Error 1

Can anyone tell me why? If I remove the #include <iostreamit compiles
without error.

Thanks for your help

Michael

-----------first file--Base.h--------

#ifndef _Base_
#define _Base_

#include <iostream>
class Base {

};

#endif

-------------second file--Other.h-------

#endif

#ifndef _Other_
#define _Other_

#include "Base.h"

class Other {
};

#endif

-------------Third file---crap.cpp-------

int main(){
}

Mar 19 '07 #3

"Jim Langston" <ta*******@rocketmail.comwrote in message
news:TG**************@newsfe04.lga...
>
"Michael" <mi*********@yahoo.comwrote in message
news:45***********************@per-qv1-newsreader-01.iinet.net.au...
>Hi All,

I have three very simple files as below.
When I try and compile these with g++ -ansi -Wall -pedantic -o crap
Base.h Other.h

Why are you trying to compile a header? You compile code (.cpp) files,
not code files.
My bad. I meant to say, You compile code (.cpp) files, not header (.h)
files.
I don't use g++ but with your sample line I think you should be doing:
g++ -ansi -Wall -pedantic -o crap crap.cpp

crap.cpp itself will pull in the headers IF you use include statments.
That is, change crap.cpp to be:

#include "Base.h"
#include "Other.h"

int main()
{
}
>I get an error:

Base.h:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.htmlfor instructions.
Other.h:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.htmlfor instructions.
make: *** [all] Error 1

Can anyone tell me why? If I remove the #include <iostreamit compiles
without error.

Thanks for your help

Michael

-----------first file--Base.h--------

#ifndef _Base_
#define _Base_

#include <iostream>
class Base {

};

#endif

-------------second file--Other.h-------

#endif

#ifndef _Other_
#define _Other_

#include "Base.h"

class Other {
};

#endif

-------------Third file---crap.cpp-------

int main(){
}


Mar 19 '07 #4

"Michael" <mi*********@yahoo.comskrev i meddelandet
news:45***********************@per-qv1-newsreader-01.iinet.net.au...
Hi All,

I have three very simple files as below.
When I try and compile these with g++ -ansi -Wall -pedantic -o crap Base.h
Other.h
I get an error:

Base.h:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.htmlfor instructions.
Other.h:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.htmlfor instructions.
make: *** [all] Error 1

Can anyone tell me why? If I remove the #include <iostreamit compiles
without error.

Thanks for your help

Michael

-----------first file--Base.h--------

#ifndef _Base_
#define _Base_

#include <iostream>
class Base {

};

#endif

-------------second file--Other.h-------

#endif
Do you really have an #endif here? If so, why?
Bo Persson
>
#ifndef _Other_
#define _Other_

#include "Base.h"

class Other {
};

#endif

-------------Third file---crap.cpp-------

int main(){
}

Mar 19 '07 #5

"Bo Persson" <bo*@gmb.dkwrote in message
news:56*************@mid.individual.net...
>
"Michael" <mi*********@yahoo.comskrev i meddelandet
news:45***********************@per-qv1-newsreader-01.iinet.net.au...
>Hi All,

I have three very simple files as below.
When I try and compile these with g++ -ansi -Wall -pedantic -o crap
Base.h Other.h
I get an error:

Base.h:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.htmlfor instructions.
Other.h:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.htmlfor instructions.
make: *** [all] Error 1

Can anyone tell me why? If I remove the #include <iostreamit compiles
without error.

Thanks for your help

Michael

-----------first file--Base.h--------

#ifndef _Base_
#define _Base_

#include <iostream>
class Base {

};

#endif

-------------second file--Other.h-------

#endif

Do you really have an #endif here? If so, why?
No, sorry, cut and paste error :-)
>
Bo Persson
>>
#ifndef _Other_
#define _Other_

#include "Base.h"

class Other {
};

#endif

-------------Third file---crap.cpp-------

int main(){
}


Mar 19 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Geoff Biggs | last post by:
Evening all, I'm trying to add a new built-in number data type to Python with its own syntax, so I'm working directly with the interpreter rather than creating my own extension module (side...
0
by: Jordan Willms | last post by:
My xsl stylesheet is as simple as follows: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:ims="http://www.imsglobal.org/xsd/imsmd_v1p2"...
9
by: Daniel Moree | last post by:
I'm using MS VC++ 6.0 I'm working on a big project. I've currently have several files for this project. Here's the problem. I have one header file phead.h I have two code files main.cpp and...
1
by: wallygato11 | last post by:
Sigh, I'm stumped so if anyone could help me it would be much appreciated. Ok I'll describe the problem as best I can. I am trying to use an application called ACCPM to solve optimization...
14
by: multiformity | last post by:
So I have been working on an opensource project for a while, and decided to really try to make it look better after focusing on the functionality most of this time. Up to now, I have simply used a...
2
by: raylopez99 | last post by:
I'm having problems compiling complex reference declarations in MSVC++.NET 2002 IDE. Here is an example: // --Foo.h-- #include "Bar.h" class Bar; //forward decl. to a class Bar in...
2
by: Mike | last post by:
Hi, I am new to C and having problems with the following program. Basically I am trying to read some files, loading data structures into memory for latter searching. I am trying to use structres...
15
by: Stoneforever | last post by:
Hi, I got a problem, I have three files, for example: /****a.h*******/ #define X1 10 #define X2 10 ...................... /****b.c*******/ #include "a.h" int add(int x,int y)
1
by: HugoScripts | last post by:
hi there, as i said i'm trying to compile a simple program that uses allegro, it's a small thing, indeed my goal was just to start using allegro, but until now i'm unable even to compile my simple...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.