visual-c++

Accessing protected members from subclasses: gcc vs msvc

In visual C++, I can do things like this: template <class T> class A{ protected: T i; }; template <class T> class B : public A<T>{ T geti() {return i;} }; If I try to compile this in g++, I get an error. I have to do this: template <class T> class B : public A<T>{ T geti() {return A<T>::i;} }; Am I not supposed to do ...

__REQUIRED_RPCNDR_H_VERSION__

I create a header file from an IDL . The IDL file has been compiled in Visual C++ 2005 . The generated header file contains #define REQUIRED_RPCNDR_H_VERSION 475 . I tried to use this header file in Visual Studio 2003 , where rpcndr.h contains { #define RPCNDR_H_VERSION ( 450 ) // and #if ( RPC...

How to initialise a rather complex char array in C?

Assuming Visual C/C++ 6, I have a complex data structure of 22399 elements that looks like this: { { "(SAME", "AS", "U+4E18)", "HILLOCK", "OR", "MOUND"}, { "TO", "LICK;", {1, 1, 0}, "TASTE,", "A", "MAT,", "BAMBOO", "BARK"}, { "(J)", "NON-STANDARD", "FORM", "OF", "U+559C", ",", {1, 1, 0}, "LIKE,", "LOVE,", "ENJOY;", {1, 1, 4}, "JOYFUL", ...

Small problem with painting scroll bars with MFC

In an MFC application there is a small rectangular region where the scroll bars meet (bottom right of the window). It seems that this region only invalidates when the frame is resized. On other occasions (for example, if another window is dragged over it), this region does not repaint. I've been able to reproduce it in VS 6 and 2008 o...

ReSharper (or something like it) for Visual C++ ?

I've seen ReSharper recommended a lot Unfortunately, it doesn't support C++ in Visual Studio. Is there anything out there you can recommend? I already use Visual Assist, and it does its job very well, but it's quite limited in comparison with ReSharper. Any suggestions? ...

How do I change OutDir variable in Visual C++?

In the linker the binary destination is specified as: $(OutDir)\$(ProjectName).exe I've looked through every setting and I can't see where OutDir is defined. How do I change this? ...

Visual c++ "for each" portability

I only just recently discovered that Visual C++ 2008 (and perhaps earlier versions as well?) supports for each syntax on stl lists et al to facilitate iteration. For example: list<Object> myList; for each (Object o in myList) { o.foo(); } I was very happy to discover it, but I'm concerned about portability for the dreaded day when ...

What is the difference between "VC++" and "C++" ?

Someone asked me how familiar I am with VC++ and how familiar I am with C++. What is the difference? ...

Missing/desired features in Visual C++

I can't find another topic where this has already been asked, so I'm starting one... if there is one, feel free to link it and close this. What feature do you feel is most missing from Visual C++? Microsoft has been adding nice features for C#/VB.NET development for the last couple versions, but C++ has felt a bit neglected. I don't ha...

How to detect VC++ 2008 redistributable?

Is there a Registry setting that I can look for to determine whether or not the Visual C++ redistributable is installed, whether standalone or as part of Visual Studio 2008? I know that I could launch the VC++ 2008 redistributable installer and let it handle the detection, but it would look cleaner if I can check for it and not bother la...

Is !! a safe way to convert to bool in C++?

[This question is related to but not the same as this one.] If I try to use values of certain types as boolean expressions, I get a warning. Rather than suppress the warning, I sometimes use the ternary operator (?:) to convert to a bool. Using two not operators (!!) seems to do the same thing. Here's what I mean: typedef long T; ...

What is the performance implication of converting to bool in C++?

[This question is related to but not the same as this one.] My compiler warns about implicitly converting or casting certain types to bool whereas explicit conversions do not produce a warning: long t = 0; bool b = false; b = t; // performance warning: forcing long to bool b = (bool)t; // perform...

SetLimitText() in a CEdit in Vista does not work

This is happening on Vista. I created a new dialog based MFC project to test this. I added a CEdit control to my dialog. I called SetLimitText to let my CEdit receive 100000 characters. I tried both: this->m_cedit1.SetLimitText(100000); UpdateData(FALSE); and static_cast<CEdit*>(GetDlgItem(IDC_EDIT1))->LimitText(100000); I placed ...

fatal error C1083: Cannot open include file: 'Windows.h': and scons

Hi, today is officially my first day with C++ :P I've downloaded Visual C++ 2005 express edition and Microsoft Platform SDK for Windows Server 2003 SP1 because I want to put my hands on open source Enso ( http : // code.google.com/p/enso ) . So, after installing scons I went to the console and try to compile it using scons but I go...

How do I assign a custom icon to a Pushpin in Mappoint ?

Hello I'm writing a MFC app that uses the MS Mappoint OCX. I need to display the locations of people and vehicles on the map and the best of doing this appears to be with Pushpin objects. I have no problem displaying a stock pushpin icon with some text but want to change the icon to a custom designed one. From the limited amount of Mapp...

How do I get output to show up in the Messages pane of the Error List for Visual Studio 2005?

I have a header file like this: #ifndef __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #define __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #ifdef _DEBUG // macros for turning a number into a string #define STRING2(x) #x #define STRING(x) STRING2(x) #ifdef TRIAGE_MESG_AS_WARNING #define TRIAGE_TODO_TAG(description) __p...

How do you add external libraries for compilation in VC++?

I've worked with a couple of Visual C++ compilers (VC97, VC2005, VC2008) and I haven't really found a clearcut way of adding external libraries to my builds. I come from a Java background, and in Java libraries are everything! I understand from compiling open-source projects on my Linux box that all the source code for the library se...

Does Visual Studio 2008 support windows 98?

Hello, We're looking at upgrading from Visual Studio 2005 to Visual Studio 2008. I discovered the following disturbing comment: http://msdn.microsoft.com/en-us/library/6sehtctf.aspx "Beginning with Visual C++ 2008, Visual C++ does not support targeting Windows 95, Windows 98, Windows ME, or Windows NT." Does this mean that if we rebu...

Debugging causing exceptions?

I was getting bad data from an application I was writting using C++ in Visual Studio 2k3 so I decided to debug it. Then I found it was throwing an exception but one I can't track down. Then I placed some try/catch blocks and low and behold, when I don't debug there is no exception. That is, I have code that looks like this: std::vecto...

Visual C++: Avoiding overlapping of paint events, arching lines through click and drag?

I am currently a student and trying to design a Visual C++ application to allow me to visually insert an oriented graph in order to create a text file with the graph's matrix. At this point I have created an onClick event to create nodes and have used the form's Paint event to draw the nodes. I have also inserted the conditions to avoid...