Search Results

Search found 17422 results on 697 pages for 'visual studio designer'.

Page 76/697 | < Previous Page | 72 73 74 75 76 77 78 79 80 81 82 83  | Next Page >

  • Erroneous/Incorrect C2248 error using Visual Studio 2010

    - by Dylan Bourque
    I'm seeing what I believe to be an erroneous/incorrect compiler error using the Visual Studio 2010 compiler. I'm in the process of up-porting our codebase from Visual Studio 2005 and I ran across a construct that was building correctly before but now generates a C2248 compiler error. Obviously, the code snippet below has been generic-ized, but it is a compilable example of the scenario. The ObjectPtr<T> C++ template comes from our codebase and is the source of the error in question. What appears to be happening is that the compiler is generating a call to the copy constructor for ObjectPtr<T> when it shouldn't (see my comment block in the SomeContainer::Foo() method below). For this code construct, there is a public cast operator for SomeUsefulData * on ObjectPtr<SomeUsefulData> but it is not being chosen inside the true expression if the ?: operator. Instead, I get the two errors in the block quote below. Based on my knowledge of C++, this code should compile. Has anyone else seen this behavior? If not, can someone point me to a clarification of the compiler resolution rules that would explain why it's attempting to generate a copy of the object in this case? Thanks in advance, Dylan Bourque Visual Studio build output: c:\projects\objectptrtest\objectptrtest.cpp(177): error C2248: 'ObjectPtr::ObjectPtr' : cannot access private member declared in class 'ObjectPtr' with [ T=SomeUsefulData ] c:\projects\objectptrtest\objectptrtest.cpp(25) : see declaration of 'ObjectPtr::ObjectPtr' with [ T=SomeUsefulData ] c:\projects\objectptrtest\objectptrtest.cpp(177): error C2248: 'ObjectPtr::ObjectPtr' : cannot access private member declared in class 'ObjectPtr' with [ T=SomeUsefulData ] c:\projects\objectptrtest\objectptrtest.cpp(25) : see declaration of 'ObjectPtr::ObjectPtr' with [ T=SomeUsefulData ] Below is a minimal, compilable example of the scenario: #include <stdio.h> #include <tchar.h> template<class T> class ObjectPtr { public: ObjectPtr<T> (T* pObj = NULL, bool bShared = false) : m_pObject(pObj), m_bObjectShared(bShared) {} ~ObjectPtr<T> () { Detach(); } private: // private, unimplemented copy constructor and assignment operator // to guarantee that ObjectPtr<T> objects are not copied ObjectPtr<T> (const ObjectPtr<T>&); ObjectPtr<T>& operator = (const ObjectPtr<T>&); public: T * GetObject () { return m_pObject; } const T * GetObject () const { return m_pObject; } bool HasObject () const { return (GetObject()!=NULL); } bool IsObjectShared () const { return m_bObjectShared; } void ObjectShared (bool bShared) { m_bObjectShared = bShared; } bool IsNull () const { return !HasObject(); } void Attach (T* pObj, bool bShared = false) { Detach(); if (pObj != NULL) { m_pObject = pObj; m_bObjectShared = bShared; } } void Detach (T** ppObject = NULL) { if (ppObject != NULL) { *ppObject = m_pObject; m_pObject = NULL; m_bObjectShared = false; } else { if (HasObject()) { if (!IsObjectShared()) delete m_pObject; m_pObject = NULL; m_bObjectShared = false; } } } void Detach (bool bDeleteIfNotShared) { if (HasObject()) { if (bDeleteIfNotShared && !IsObjectShared()) delete m_pObject; m_pObject = NULL; m_bObjectShared = false; } } bool IsEqualTo (const T * pOther) const { return (GetObject() == pOther); } public: T * operator -> () { ASSERT(HasObject()); return m_pObject; } const T * operator -> () const { ASSERT(HasObject()); return m_pObject; } T & operator * () { ASSERT(HasObject()); return *m_pObject; } const T & operator * () const { ASSERT(HasObject()); return (const C &)(*m_pObject); } operator T * () { return m_pObject; } operator const T * () const { return m_pObject; } operator bool() const { return (m_pObject!=NULL); } ObjectPtr<T>& operator = (T * pObj) { Attach(pObj, false); return *this; } bool operator == (const T * pOther) const { return IsEqualTo(pOther); } bool operator == (T * pOther) const { return IsEqualTo(pOther); } bool operator != (const T * pOther) const { return !IsEqualTo(pOther); } bool operator != (T * pOther) const { return !IsEqualTo(pOther); } bool operator == (const ObjectPtr<T>& other) const { return IsEqualTo(other.GetObject()); } bool operator != (const ObjectPtr<T>& other) const { return !IsEqualTo(other.GetObject()); } bool operator == (int pv) const { return (pv==NULL)? IsNull() : (LPVOID(m_pObject)==LPVOID(pv)); } bool operator != (int pv) const { return !(*this == pv); } private: T * m_pObject; bool m_bObjectShared; }; // Some concrete type that holds useful data class SomeUsefulData { public: SomeUsefulData () {} ~SomeUsefulData () {} }; // Some concrete type that holds a heap-allocated instance of // SomeUsefulData class SomeContainer { public: SomeContainer (SomeUsefulData* pUsefulData) { m_pData = pUsefulData; } ~SomeContainer () { // nothing to do here } public: bool EvaluateSomeCondition () { // fake condition check to give us an expression // to use in ?: operator below return true; } SomeUsefulData* Foo () { // this usage of the ?: operator generates a C2248 // error b/c it's attempting to call the copy // constructor on ObjectPtr<T> return EvaluateSomeCondition() ? m_pData : NULL; /**********[ DISCUSSION ]********** The following equivalent constructs compile w/out error and behave correctly: (1) explicit cast to SomeUsefulData* as a comiler hint return EvaluateSomeCondition() ? (SomeUsefulData *)m_pData : NULL; (2) if/else instead of ?: if (EvaluateSomeCondition()) return m_pData; else return NULL; (3) skip the condition check and return m_pData as a SomeUsefulData* directly return m_pData; **********[ END DISCUSSION ]**********/ } private: ObjectPtr<SomeUsefulData> m_pData; }; int _tmain(int argc, _TCHAR* argv[]) { return 0; }

    Read the article

  • Selectable TreeView in Visual C#

    - by jpavlov
    Are there any good tutorials out there to develop a selectable TreeView in Visual Studios? What I am searching for is for something that would display my drives in a tree view and have a checkbox next to each drive, folder and file. This will be used in a replication program. Thanks a million.

    Read the article

  • Recommended migration strategy for C++ project in Visual Studio 6

    - by jacobsee
    For a large application written in C++ using Visual Studio 6, what is the best way to move into the modern era? I'd like to take an incremental approach where we slowly move portions of the code and write new features into C# for example and compile that into a library or dll that can be referenced from the legacy application. Is this possible and what is the best way to do it?

    Read the article

  • Let's improve Visual Studio 2010

    - by Knowing me knowing you
    I wonder if some of you would like the idea to collect in this place features/improvements we would like to see most in visual studio, vote for them and then send them (these with the most votes) to VS Team. Maybe some of them would make their way into another release of VS. Looking forward to see what you're thinking about it.

    Read the article

  • How to best use GCC with Visual Studio

    - by Oops
    I know this thread http://stackoverflow.com/questions/216025/gcc-with-visual-studio but to me it seems that everything mentioned there is rather outdated and it seems to be the tenor is: don't do it Who knows a better step by step explanation thank you in advance Oops

    Read the article

  • Visual Studio 2008 - Assemblies are not loaded into Modules after relocating the website and project

    - by user296861
    I recently moved the asp.net website solution folder (along with class projects) to different location. As the result, visual studio doesn't stop at break points, and I could not able to debug. I see none of my assemblies at Debug Windows Modules; only microsoft assemblies are loaded. I have also deleted all bin folder and re-referenced all projects. But still no luck. Thanks in advance!

    Read the article

  • group member dropdown in visual studio 2008

    - by knittl
    in visual studio is the member dropdown, where you can select all members of the current type alphabetically ordered. is there an option which allows grouping of the members? i.e. all constructors before all methods before all properties before all events before all fields? if there is not, bad for me, i guess—it would really enhance productivity

    Read the article

  • Word 2007 Documents in Visual Studio 2010

    - by Will Eddins
    I'm currently using Visual Studio 2010 Professional, and noticed the ability to create Word 2007 and Word 2010 documents with C# code-behinds. What I'm looking to do is fill in a report-type document with information in my C# application, and then output the final .docx. Is this possible using this feature, and how do I go about doing it?

    Read the article

  • C++ Change image based on a click (Visual Studio C++)

    - by Jimbo
    In visual studio, when making a C++ windows application form. I want a picture to change when I click on it. So when I double click the picture and it brings up the click action script, what script do I use..... Similiar to int temp = System::Int32::Parse(label1->Text); temp++; label1->Text = temp.ToString(); Which just increments an integer in a label

    Read the article

  • How to set Visual Studio to Publish pdf files

    - by TheAlbear
    Is there a way to set visual studio to publish all pdf files? I know that you can set each indivdual pdf file in a project with the "Copy to Outpub Directory" property. But that means doing the same thing 100's of times for my current project, is there a way to change a global setting to do the same thing?

    Read the article

  • check compiler version in visual studio 2008

    - by snorlaks
    Hello, Im writing application in c++ and after try to run built (in debug mode) application on another machine I had error (The application has failed to start because its side-by-side configuration is incorect). I realised that there are missed DLLs from windows\WinSxS\ But I dont really know which folder contains what I really need and secondly I dont know how to check my compiler version in visual studio. Thanks for help

    Read the article

  • Run multiple copies of an app from Visual Studio

    - by HeavyWave
    How can I run multiple copies of the same app in Debug with Visual Studio? For instance, how do I run app.exe /option1 and app.exe /option2 and still debug both? I know I can run them manually and then attach, but I want an automated solution. I have tried writing a small console app just to run 2 processes, but obviously they are not being run under debugger. Any ideas?

    Read the article

< Previous Page | 72 73 74 75 76 77 78 79 80 81 82 83  | Next Page >