473,769 Members | 7,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3510
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("\nCaugh t");
}
}

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("\nCaugh t");
}
}

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("\nCaugh t");
}
}

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
2232
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
3336
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 rightType;
5
3821
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 ) Person.xsd includes Common-Naming.xsd ( anonimous schemas ) Common-Naming.xsd includes common.xsd ( both are anonimous schemas ) Compilation of Resident.xsd raise the following exception: "System.Xml.Schema.XmlSchemaException: The attribute 'oid'...
10
19729
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 have a struct that contains several different types of data. This struct is used throuout the program. Now, when I compile, I get 6 errors, all of them "Use of possibly unassigned field 'awayTime'" or "Use of possibly unassigned field 'intlTime'"....
6
2859
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 fine while the file was in the project directory. When the obsolete file was removed from the project directory, my application will no longer compile. Can someone please help with this issue? Thank in advance, Tom
0
1904
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 had developed which would handle all database access. After I modified all of the code to point to the new namespace and created all of the necessary references, I get an internal compile error when I attempt to re-compile. I have create a new...
9
3519
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 has mandatory parameters, I mean, they should not be null nor empty (for strings). So I'd make the validation in the constructor and generate a compile-time error if the validation does not match... Is there a way to achieve this or to specify...
4
1844
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: C:\PK\Development\Products\UTCAS\4.0\SRC\MeltPracApplication\Dialog\Composit ionForm.cs(942): Argument '1': cannot convert from 'ref MeltPracData.MeltPracDataComposition' to 'ref MeltPracCommon.IDialogPostData'
5
5043
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
4141
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 message is: E:\software\development\boost_1_35_0\boost_1_35_0>bjam -- toolset=msvc-7.1 --variant=release --threading=multi --link=shared --
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.