473,320 Members | 1,961 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,320 software developers and data experts.

compile error

hi
the following may be offtopic.
gcc 3.3.3 compiler throws error like

.....: error: invalid in-class
initialization of static data member of non-integral type `const
char[]'

...... error: looser throw specifier for virtual void X::y()
etc

for the same source gcc 2.95.2 doesn't throw any error. What could be
the reason ?
1 more thing...-fno-rtti doesn't have any affect on gcc 3.3.3. In both
the cases -frtti and -fno-rtti, code generated are same.
did i miss any patch or what is the recent gcc version which works ?

Thanks
Jul 22 '05 #1
5 3454
shishir wrote:
the following may be offtopic.
gcc 3.3.3 compiler throws error like

....: error: invalid in-class
initialization of static data member of non-integral type `const
char[]'

..... error: looser throw specifier for virtual void X::y()
etc

for the same source gcc 2.95.2 doesn't throw any error. What could be
the reason ?
I know of one reason: 3.3.3 is more Standard-compliant than 2.95.2.
1 more thing...-fno-rtti doesn't have any affect on gcc 3.3.3. In both
the cases -frtti and -fno-rtti, code generated are same.
did i miss any patch or what is the recent gcc version which works ?


Ask in gnu.gcc.help. Adding or not adding RTTI has no effect if your
code doesn't use RTTI (typeid operator and so on)

Victor
Jul 22 '05 #2
shishir wrote:
hi
the following may be offtopic.
gcc 3.3.3 compiler throws error like

....: error: invalid in-class
initialization of static data member of non-integral type `const
char[]'

..... error: looser throw specifier for virtual void X::y()
etc

for the same source gcc 2.95.2 doesn't throw any error. What could be
the reason ?
Maybe just because you did the things it's complaining about. Newer
versions of gcc are much more standard compliant than older ones,
resulting in more errors if your code is invalid.
1 more thing...-fno-rtti doesn't have any affect on gcc 3.3.3. In both
the cases -frtti and -fno-rtti, code generated are same.
Are you actually using any rtti in your code?
did i miss any patch or what is the recent gcc version which works ?


They should all work well.

Jul 22 '05 #3
> Are you actually using any rtti in your code?
int main()
{
try
{
throw new int()
}
catch (...)
{
printf("\nCaught");
}
}

the above piece of code produces the same object code with -frrti and
-fno-rtti option.
They should all work well.

Also, gcc fails to link c++ object codes, it is the g++ which is able
to link.
Jul 22 '05 #4
shishir wrote:
Are you actually using any rtti in your code?

int main()
{
try
{
throw new int()
}
catch (...)
{
printf("\nCaught");
}
}

the above piece of code produces the same object code with -frrti and
-fno-rtti option.


That's because it doesn't use RTTI. You seem to be confusing exceptions
with RTTI.
Try this instead:

#include <iostream>

struct A { virtual ~A() {} };
struct B: public A {};

int main()
{
A* a = new B();
std::cout << typeid(a).name() << std::endl;
delete a;
}
They should all work well.

Also, gcc fails to link c++ object codes, it is the g++ which is able
to link.


Yes. That's intended. gcc won't link in the C++ standard library.

Jul 22 '05 #5
Rolf Magnus wrote:
shishir wrote:
Are you actually using any rtti in your code? int main()
{
try
{
throw new int()
}
catch (...)
{
printf("\nCaught");
}
}

the above piece of code produces the same object code with -frrti and
-fno-rtti option.


That's because it doesn't use RTTI. You seem to be confusing
exceptions with RTTI.
Try this instead:

#include <iostream>

struct A { virtual ~A() {} };
struct B: public A {};

int main()
{
A* a = new B();
std::cout << typeid(a).name() << std::endl;


Oops. Of course, it would have to be:

std::cout << typeid(*a).name() << std::endl;
delete a;
}
They should all work well.

Also, gcc fails to link c++ object codes, it is the g++ which is able
to link.


Yes. That's intended. gcc won't link in the C++ standard library.


Jul 22 '05 #6

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

Similar topics

4
by: Danny Boelens | last post by:
Hi all, today I ran into a compile error after a compiler upgrade. I made a small example to demonstrate my compile error: template<typename T1, typename T2> class A {}; class B
5
by: Carmine Cairo | last post by:
Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new...
5
by: Brice Prunier | last post by:
Here under 4 schemas i'm working with ( it may be long: sorry...) The context is the following : Resident.xsd imports Person.xsd and includes Common.xsd ( anonimous schema: no TargetNamespace )...
10
by: Chris LaJoie | last post by:
Our company has been developing a program in C# for some time now, and we haven't had any problems with it, but just last night something cropped up that has me, and everyone else, stumped. I...
6
by: Thomas Connolly | last post by:
I have 2 pages referencing the same codebehind file in my project. Originally the pages referenced separate code behind files. Once I changed the reference to the same file, everything worked...
0
by: Jim Heavey | last post by:
Internal Compiler Error: stage 'BEGIN' Hello, I had an application which was working just fine and I decided to modify all database access within the application to utilizie a new Namespace that I...
9
by: ThunderMusic | last post by:
Hi, I'd like to create a compile time error in my class... maybe there's a way already built in in the framework so I can achieve what I want... I have 2 constructors in my class. One of them...
4
by: tony | last post by:
Hello! My question is about calling this method CollectData below but I get a compile error that I shouldn't have because the type parameter is correct. The compile error is the following:...
5
by: wong_powah | last post by:
#include <vector> #include <iostream> using std::cout; using std::vector; enum {DATASIZE = 20}; typedef unsigned char data_t;
2
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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...
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)...
0
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

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.