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

VC++ 7.1 RTTI bug from IDE?

This little program:

#include <iostream>
int main()
{
#ifdef _CPPRTTI
std::cout << "_CPPRTTI is defined as " << _CPPRTTI << "\n";
#else
std::cout << "_CPPRTTI is not defined\n";
#endif
return 0;
}

Works as expected when compiled from the command line. /GR determines
which version of the code is selected.

From the IDE (7.1 retail product), the output is always "_CPPRTTI is
not defined", regardless of the setting of the Property | C/C++ |
Language | Enable Run-Time Type Info.

Looking at the Property | C/C++ | Command Line | All Options: I can
see that /GR is shown, but appears to have no effect. If /GR is added
via the Additional Options, the program then outputs "_CPPRTTI is
defined as 1".

Is this a known bug?

--Beman
Nov 16 '05 #1
6 3355
David Lowndes <da****@mvps.org> wrote in message news:<i5********************************@4ax.com>. ..
This little program:
...
Works as expected when compiled from the command line. /GR determines
which version of the code is selected.

From the IDE (7.1 retail product), the output is always "_CPPRTTI is
not defined", regardless of the setting of the Property | C/C++ |
Language | Enable Run-Time Type Info.


Setting "Enable Run-Time Type Info" in the IDE for a console
application defines that symbol ok for me with your sample - without
having to explicitly enter it into the command line additional options
setting.


It figures that such an obvious problem would have been detected long
ago if it always happened. And in fact, if I start a totally new
solution, add a totally new project, enter the .cpp file as a totally
new file, set the properties per above, then there is no sign of the
error.

Yet if I go back to the original solution, the error is still very
much in evidence. No amount of turning "Enable Run-Time Type Info" on
or off has any effect. (I tried at both the project and file level.)

It gets even weirder. The error happens in both debug and release
mode, but for the Microsoft compiler only. Switch to the Inter
compiler (VC++ and Intel C++ are the two installed products), and
everything works correctly. Back to the Microsoft compiler, and the
problem is still there.

Any ideas?

--Beman Dawes
Nov 16 '05 #2
Beman Dawes wrote:
It gets even weirder. The error happens in both debug and release
mode, but for the Microsoft compiler only. Switch to the Intel
compiler (VC++ and Intel C++ are the two installed products), and
everything works correctly. Back to the Microsoft compiler, and the
problem is still there.

Any ideas?


That is wierd.

What's the complete set of command line arguments that the IDE is passing to
the compiler? (These are visible in BuildLog.htm - look there rather than
in the IDE dialogs to be sure).

-cd
Nov 16 '05 #3
"Carl Daniel [VC++ MVP]" <cp******@nospam.mvps.org> wrote in message news:<OE**************@TK2MSFTNGP12.phx.gbl>...
What's the complete set of command line arguments that the IDE is passing to
the compiler? (These are visible in BuildLog.htm - look there rather than
in the IDE dialogs to be sure).


BuildLog.htm reports:

/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm /EHsc /RTC1
/MLd /Zc:forScope /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c /Wp64 /ZI /TP
"\sq\build\sq-vc7.1\GX_GR.cpp"

Property Pages | C/C++ | Command Line reports:

/c /ZI /nologo /W3 /Wp64 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D
"_MBCS" /Gm /EHsc /RTC1 /MLd /Zc:forScope /GR /Fo"Debug/"
/Fd"Debug/vc70.pdb" /Gd /TP

Note /GR in the latter, but not in the former. This is consistent with
the observed behavior of the resulting program; the compiler (cl.exe)
gets it right. The fault seems to be that the IDE is not passing /GR
to the compiler.

--Beman
Nov 16 '05 #4
Beman Dawes wrote:
"Carl Daniel [VC++ MVP]" <cp******@nospam.mvps.org> wrote in message
news:<OE**************@TK2MSFTNGP12.phx.gbl>...
What's the complete set of command line arguments that the IDE is
passing to
the compiler? (These are visible in BuildLog.htm - look there
rather than
in the IDE dialogs to be sure).


BuildLog.htm reports:

/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm /EHsc /RTC1
/MLd /Zc:forScope /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c /Wp64 /ZI /TP
"\sq\build\sq-vc7.1\GX_GR.cpp"

Property Pages | C/C++ | Command Line reports:

/c /ZI /nologo /W3 /Wp64 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D
"_MBCS" /Gm /EHsc /RTC1 /MLd /Zc:forScope /GR /Fo"Debug/"
/Fd"Debug/vc70.pdb" /Gd /TP

Note /GR in the latter, but not in the former. This is consistent with
the observed behavior of the resulting program; the compiler (cl.exe)
gets it right. The fault seems to be that the IDE is not passing /GR
to the compiler.


Yep. Seems there's a problem with the build system in the IDE. I'll make
sure someone from the VC team noticies this thread - would you be able to
post the .vcproj file? If it's confidential, I'm sure someone from the team
would take it by email if you're unable/unwilling to post it.

-cd
Nov 16 '05 #5
"Carl Daniel [VC++ MVP]" <cp******@nospam.mvps.org> wrote in message news:<Oe**************@TK2MSFTNGP10.phx.gbl>...
Yep. Seems there's a problem with the build system in the IDE. I'll make
sure someone from the VC team noticies this thread - would you be able to
post the .vcproj file? If it's confidential, I'm sure someone from the team
would take it by email if you're unable/unwilling to post it.


I'm bailing out for a few days of vacation. I'll try to get something
together when I get back.

Thanks,

--Beman
Nov 16 '05 #6
I bet you imported the project from MSVC 6, and, in original project, you
didn't have RTTI enabled.

When imported from VC6, most settings are explicitly set on individual
files, and not inherited from the project.
So if you then change settings at the project level, they have no effect.

These are (open Properties for any individual .cpp file, and _not_ for the
project):

- Include Directories (C/C++/General/Additional Include Directories, notice
the ($NoInherit) string)
- Preprocessor definitions (C/C++/Preprocessor Definitions, notice the
($NoInherit) string)
- and a lot of other settings, including 'Enable Run-time Type Info'
(notice that some settings are shown in bold - it means that the
corresponding project-level setting has no effect for that file).

--
Andrew Burlak
Nov 16 '05 #7

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

Similar topics

9
by: Rick | last post by:
Hi, I wrote a few classes recently and am writing a small GC implementation for C++. I will be implementing my own gc_ptr type maintain a list where I'll store pointers to allocated memory. I...
2
by: shishir | last post by:
Please consider the following //file test.cpp #include <iostream> int main() { int x; try { throw x;
6
by: Kleidemos | last post by:
If I implement a simple RTTI system, more simple than C++ RTTI system for my program and this system is plus or minus: #define DEF_RTTI_BASE(name) virtual inline const char *Name(){ return...
9
by: Agoston Bejo | last post by:
Hello there, I would like to know what overheads there are to think of when using RTTI. I understand that enabling RTTI increases the sizes of the classes, but not the objects themselves. This...
2
by: denny | last post by:
Hey all, I know that dynamic_cast<> takes some time, but , for instance, is there a memoy cost associated in with it? Does it have to maintain a table in memory, thus bloating the runtime ram...
3
by: Steven T. Hatton | last post by:
I'm trying to work out a design for dynamically determining file types, and for generating new files of a given type. I'm curious to know what others think of my current strategy. Is it "so...
5
by: dotNeter | last post by:
I'm studying the RTTI, and my current work is concern for how to get the self-defined type at runtime, that's exactly what the RTTI does. I mean, in my application, I built several self-defined...
2
by: Chameleon | last post by:
I know than dynamic_cast check string name of derived to base class and if one of them match, return the pointer of that object or else zero. I suppose, I dynamic_cast instead of strings, checks...
2
by: Ryanivanka | last post by:
hi, is there anything in VC can do the job like Reflection in .NET? i mean by setting some attribute and get runtime information?
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: 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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.