Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. stupid VC++ 7 error...

stupid VC++ 7 error...

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++visual-studiocomgraphics
20 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mario M
    wrote on last edited by
    #1

    Hi, Does anyone knows why I get this stupid error when trying to compile this source code http://www.codeproject.com/dialog/selectcomputerdialog.asp with Visual C++ 6.0 it compiles without problems, but with Visual Studio .net (release candidate) I get this error... X| e:\VSNet\Vc7\include\xutility(398) : error C2440: 'return' : cannot convert from 'NETRESOURCE *' to 'std::vector<_Ty,_Ax>::_Tptr ' with [ _Ty=CSelectComputerNetwork::CNETRESOURCE, _Ax=std::allocator ] Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast e:\VSNet\Vc7\include\xutility(397) : while compiling class-template member function 'std::vector<_Ty,_Ax>::_Tptr *std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2>::operator ->(void) const' with [ _Ty=CSelectComputerNetwork::CNETRESOURCE, _Ax=std::allocator, _Diff=std::vector>::difference_type, _Pointer=std::vector>::_Tptr, _Reference=std::vector>::reference, _Pointer2=std::vector>::_Tptr, _Reference2=std::vector>::reference ] e:\VSNet\Vc7\include\vector(372) : see reference to class template instantiation 'std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2>' being compiled with [ _Ty=std::vector>::value_type, _Diff=std::vector>::difference_type, _Pointer=std::vector>::_Tptr, _Reference=std::vector>::reference, _Pointer2=std::vector

    N J C 3 Replies Last reply
    0
    • M Mario M

      Hi, Does anyone knows why I get this stupid error when trying to compile this source code http://www.codeproject.com/dialog/selectcomputerdialog.asp with Visual C++ 6.0 it compiles without problems, but with Visual Studio .net (release candidate) I get this error... X| e:\VSNet\Vc7\include\xutility(398) : error C2440: 'return' : cannot convert from 'NETRESOURCE *' to 'std::vector<_Ty,_Ax>::_Tptr ' with [ _Ty=CSelectComputerNetwork::CNETRESOURCE, _Ax=std::allocator ] Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast e:\VSNet\Vc7\include\xutility(397) : while compiling class-template member function 'std::vector<_Ty,_Ax>::_Tptr *std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2>::operator ->(void) const' with [ _Ty=CSelectComputerNetwork::CNETRESOURCE, _Ax=std::allocator, _Diff=std::vector>::difference_type, _Pointer=std::vector>::_Tptr, _Reference=std::vector>::reference, _Pointer2=std::vector>::_Tptr, _Reference2=std::vector>::reference ] e:\VSNet\Vc7\include\vector(372) : see reference to class template instantiation 'std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2>' being compiled with [ _Ty=std::vector>::value_type, _Diff=std::vector>::difference_type, _Pointer=std::vector>::_Tptr, _Reference=std::vector>::reference, _Pointer2=std::vector

      N Offline
      N Offline
      Nemanja Trifunovic
      wrote on last edited by
      #2

      I had a similar problem, and it turned out that the standard library shipped with VC6 is not in accordance to ISO C++. They fixed it in VC 7.0, and now some VC6 code cannot be built with VC7. After all, we asked for better standard conformance, didn't we? :rolleyes: I vote pro drink :beer:

      M 1 Reply Last reply
      0
      • N Nemanja Trifunovic

        I had a similar problem, and it turned out that the standard library shipped with VC6 is not in accordance to ISO C++. They fixed it in VC 7.0, and now some VC6 code cannot be built with VC7. After all, we asked for better standard conformance, didn't we? :rolleyes: I vote pro drink :beer:

        M Offline
        M Offline
        Mario M
        wrote on last edited by
        #3

        Thanks, I knew this. :(( I fixed the other 200 errors from my sources..., but I'm not an STL professional and I cannot fix this error. any help would be appreciated...:-O

        J 1 Reply Last reply
        0
        • M Mario M

          Hi, Does anyone knows why I get this stupid error when trying to compile this source code http://www.codeproject.com/dialog/selectcomputerdialog.asp with Visual C++ 6.0 it compiles without problems, but with Visual Studio .net (release candidate) I get this error... X| e:\VSNet\Vc7\include\xutility(398) : error C2440: 'return' : cannot convert from 'NETRESOURCE *' to 'std::vector<_Ty,_Ax>::_Tptr ' with [ _Ty=CSelectComputerNetwork::CNETRESOURCE, _Ax=std::allocator ] Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast e:\VSNet\Vc7\include\xutility(397) : while compiling class-template member function 'std::vector<_Ty,_Ax>::_Tptr *std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2>::operator ->(void) const' with [ _Ty=CSelectComputerNetwork::CNETRESOURCE, _Ax=std::allocator, _Diff=std::vector>::difference_type, _Pointer=std::vector>::_Tptr, _Reference=std::vector>::reference, _Pointer2=std::vector>::_Tptr, _Reference2=std::vector>::reference ] e:\VSNet\Vc7\include\vector(372) : see reference to class template instantiation 'std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2>' being compiled with [ _Ty=std::vector>::value_type, _Diff=std::vector>::difference_type, _Pointer=std::vector>::_Tptr, _Reference=std::vector>::reference, _Pointer2=std::vector

          J Offline
          J Offline
          James R Twine
          wrote on last edited by
          #4

          Mario M. wrote: cannot convert from 'NETRESOURCE *' to 'std::vector<_Ty,_Ax>::_Tptr    Misuse of STL?    Peace! -=- James.

          1 Reply Last reply
          0
          • M Mario M

            Thanks, I knew this. :(( I fixed the other 200 errors from my sources..., but I'm not an STL professional and I cannot fix this error. any help would be appreciated...:-O

            J Offline
            J Offline
            James R Twine
            wrote on last edited by
            #5

            (ooop. Did not catch the other Reply before I wrote mine...) Mario M. wrote: but I'm not an STL professional and I cannot fix this error. any help would be appreciated..    A Code sample would be a good start.  Include the def. of the collection in use.    Peace! -=- James.

            M 1 Reply Last reply
            0
            • M Mario M

              Hi, Does anyone knows why I get this stupid error when trying to compile this source code http://www.codeproject.com/dialog/selectcomputerdialog.asp with Visual C++ 6.0 it compiles without problems, but with Visual Studio .net (release candidate) I get this error... X| e:\VSNet\Vc7\include\xutility(398) : error C2440: 'return' : cannot convert from 'NETRESOURCE *' to 'std::vector<_Ty,_Ax>::_Tptr ' with [ _Ty=CSelectComputerNetwork::CNETRESOURCE, _Ax=std::allocator ] Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast e:\VSNet\Vc7\include\xutility(397) : while compiling class-template member function 'std::vector<_Ty,_Ax>::_Tptr *std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2>::operator ->(void) const' with [ _Ty=CSelectComputerNetwork::CNETRESOURCE, _Ax=std::allocator, _Diff=std::vector>::difference_type, _Pointer=std::vector>::_Tptr, _Reference=std::vector>::reference, _Pointer2=std::vector>::_Tptr, _Reference2=std::vector>::reference ] e:\VSNet\Vc7\include\vector(372) : see reference to class template instantiation 'std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2>' being compiled with [ _Ty=std::vector>::value_type, _Diff=std::vector>::difference_type, _Pointer=std::vector>::_Tptr, _Reference=std::vector>::reference, _Pointer2=std::vector

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              My first guess is someone tried to return an iterator from a function that wants to return a pointer, which VC6 probably would be more likely to let you get away with. As has been said, it is kind of pointless asking these questions if you're not going to post some code. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

              Sonork ID 100.10002:MeanManOz

              I live in Bob's HungOut now

              M 1 Reply Last reply
              0
              • J James R Twine

                (ooop. Did not catch the other Reply before I wrote mine...) Mario M. wrote: but I'm not an STL professional and I cannot fix this error. any help would be appreciated..    A Code sample would be a good start.  Include the def. of the collection in use.    Peace! -=- James.

                M Offline
                M Offline
                Mario M
                wrote on last edited by
                #7

                I have other source codes which uses vector and compiles fine, I think there is something which was changed by MS in this new VC++ release...

                J 1 Reply Last reply
                0
                • C Christian Graus

                  My first guess is someone tried to return an iterator from a function that wants to return a pointer, which VC6 probably would be more likely to let you get away with. As has been said, it is kind of pointless asking these questions if you're not going to post some code. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

                  Sonork ID 100.10002:MeanManOz

                  I live in Bob's HungOut now

                  M Offline
                  M Offline
                  Mario M
                  wrote on last edited by
                  #8

                  Hi, You can find the complete source code project here http://www.codeproject.com/dialog/selectcomputerdialog.asp Mario

                  C 1 Reply Last reply
                  0
                  • M Mario M

                    Hi, You can find the complete source code project here http://www.codeproject.com/dialog/selectcomputerdialog.asp Mario

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #9

                    I'm not going to reboot into W2000, run .Net ( which I still don't know my way around ), reboot again, redial the internet, when you can just post the offending line of source yourself. To be honest, if it wasn't that much hassle, I would do it gladly, although I still think you should have posted the source that is crashing, but to test under .Net is simply too much hassle for me. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

                    Sonork ID 100.10002:MeanManOz

                    I live in Bob's HungOut now

                    M 1 Reply Last reply
                    0
                    • M Mario M

                      I have other source codes which uses vector and compiles fine, I think there is something which was changed by MS in this new VC++ release...

                      J Offline
                      J Offline
                      James R Twine
                      wrote on last edited by
                      #10

                      Mario M. wrote: I have other source codes which uses vector and compiles fine, I think there is something which was changed by MS in this new VC++ release...    I have seen the same thing happen when people moved off of VC++ 6.0's STL code to Dinkumware's STL or STLPort.  The reason I suggested is still a possibility.  So again, can we get a code snippet (not a code archive) that shows the code around, and including the problem (include things like variable declarations, STL typedefs, etc.)    Peace! -=- James.

                      1 Reply Last reply
                      0
                      • C Christian Graus

                        I'm not going to reboot into W2000, run .Net ( which I still don't know my way around ), reboot again, redial the internet, when you can just post the offending line of source yourself. To be honest, if it wasn't that much hassle, I would do it gladly, although I still think you should have posted the source that is crashing, but to test under .Net is simply too much hassle for me. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

                        Sonork ID 100.10002:MeanManOz

                        I live in Bob's HungOut now

                        M Offline
                        M Offline
                        Mario M
                        wrote on last edited by
                        #11

                        The error comes from the first line here... ---- vector vecnrDomains; if (!EnumDomains(NULL, vecnrDomains)) return false; for (vector::const_iterator ci = vecnrDomains.begin(); ci != vecnrDomains.end(); ++ci) vecstrDomains.push_back(ci->GetRemoteName()); ------ I am not the author of these sources, someone else posted it to codeguru.com, and it works fine with VC++ 6. - Mario

                        C 1 Reply Last reply
                        0
                        • M Mario M

                          The error comes from the first line here... ---- vector vecnrDomains; if (!EnumDomains(NULL, vecnrDomains)) return false; for (vector::const_iterator ci = vecnrDomains.begin(); ci != vecnrDomains.end(); ++ci) vecstrDomains.push_back(ci->GetRemoteName()); ------ I am not the author of these sources, someone else posted it to codeguru.com, and it works fine with VC++ 6. - Mario

                          C Offline
                          C Offline
                          Christian Graus
                          wrote on last edited by
                          #12

                          Mario M. wrote: The error comes from the first line here... ---- vector vecnrDomains; if (!EnumDomains(NULL, vecnrDomains)) return false; for (vector::const_iterator ci = vecnrDomains.begin(); ci != vecnrDomains.end(); ++ci) vecstrDomains.push_back(ci->GetRemoteName()); ------ You mean declaring the vector ? Your <> pairs were lost because you didn't post 'as-is' ( see the check box below as you're typing your post ), but whatever is in the vector: does it have a copy constructor ? Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

                          Sonork ID 100.10002:MeanManOz

                          I live in Bob's HungOut now

                          M 1 Reply Last reply
                          0
                          • C Christian Graus

                            Mario M. wrote: The error comes from the first line here... ---- vector vecnrDomains; if (!EnumDomains(NULL, vecnrDomains)) return false; for (vector::const_iterator ci = vecnrDomains.begin(); ci != vecnrDomains.end(); ++ci) vecstrDomains.push_back(ci->GetRemoteName()); ------ You mean declaring the vector ? Your <> pairs were lost because you didn't post 'as-is' ( see the check box below as you're typing your post ), but whatever is in the vector: does it have a copy constructor ? Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

                            Sonork ID 100.10002:MeanManOz

                            I live in Bob's HungOut now

                            M Offline
                            M Offline
                            Mario M
                            wrote on last edited by
                            #13

                            I have modified the post to 'as-is'. And here is the vector class... also you can read again the previous message with 'as-is'... class CSelectComputerNetwork { public: CSelectComputerNetwork(); virtual ~CSelectComputerNetwork(); public: static bool GetDomains(vector >& vecstrDomains); static bool GetServers(const basic_string& strDomain, vector >& vecstrServers); private: //NETRESOURCE structure wrapper used to save text data that freed by WNetEnumClose(_); class CNETRESOURCE { public: CNETRESOURCE(const NETRESOURCE& nr): m_nr(nr) { m_strLocalName = nr.lpLocalName ? nr.lpLocalName : _T(""); m_strRemoteName = nr.lpRemoteName ? nr.lpRemoteName : _T(""); m_strComment = nr.lpComment ? nr.lpComment : _T(""); m_strProvider = nr.lpProvider ? nr.lpProvider : _T(""); m_nr.lpLocalName = new TCHAR [m_strLocalName.size() + 1]; _tcscpy(m_nr.lpLocalName, m_strLocalName.c_str()); m_nr.lpRemoteName = new TCHAR [m_strRemoteName.size() + 1]; _tcscpy(m_nr.lpRemoteName, m_strRemoteName.c_str()); m_nr.lpComment = new TCHAR [m_strComment.size() + 1]; _tcscpy(m_nr.lpComment, m_strComment.c_str()); m_nr.lpProvider = new TCHAR [m_strProvider.size() + 1]; _tcscpy(m_nr.lpProvider, m_strProvider.c_str()); } CNETRESOURCE(const CNETRESOURCE& rhs): m_nr(rhs.m_nr), m_strLocalName(rhs.m_strLocalName), m_strRemoteName(rhs.m_strRemoteName), m_strComment(rhs.m_strComment), m_strProvider(rhs.m_strProvider) { m_nr.lpLocalName = new TCHAR [m_strLocalName.size() + 1]; _tcscpy(m_nr.lpLocalName, m_strLocalName.c_str()); m_nr.lpRemoteName = new TCHAR [m_strRemoteName.size() + 1]; _tcscpy(m_nr.lpRemoteName, m_strRemoteName.c_str()); m_nr.lpComment = new TCHAR [m_strComment.size() + 1]; _tcscpy(m_nr.lpComment, m_strComment.c_str()); m_nr.lpProvider = new TCHAR [m_strProvider.size() + 1]; _tcscpy(m_nr.lpProvider, m_strProvider.c_str()); } ~CNETRESOURCE() { delete [] m_nr.lpLocalName; delete [] m_nr.lpRemoteName; delete [] m_nr.lpComment; delete [] m_nr.lpProvider; } public: NETRESOURCE* operator &() {

                            C T 2 Replies Last reply
                            0
                            • M Mario M

                              I have modified the post to 'as-is'. And here is the vector class... also you can read again the previous message with 'as-is'... class CSelectComputerNetwork { public: CSelectComputerNetwork(); virtual ~CSelectComputerNetwork(); public: static bool GetDomains(vector >& vecstrDomains); static bool GetServers(const basic_string& strDomain, vector >& vecstrServers); private: //NETRESOURCE structure wrapper used to save text data that freed by WNetEnumClose(_); class CNETRESOURCE { public: CNETRESOURCE(const NETRESOURCE& nr): m_nr(nr) { m_strLocalName = nr.lpLocalName ? nr.lpLocalName : _T(""); m_strRemoteName = nr.lpRemoteName ? nr.lpRemoteName : _T(""); m_strComment = nr.lpComment ? nr.lpComment : _T(""); m_strProvider = nr.lpProvider ? nr.lpProvider : _T(""); m_nr.lpLocalName = new TCHAR [m_strLocalName.size() + 1]; _tcscpy(m_nr.lpLocalName, m_strLocalName.c_str()); m_nr.lpRemoteName = new TCHAR [m_strRemoteName.size() + 1]; _tcscpy(m_nr.lpRemoteName, m_strRemoteName.c_str()); m_nr.lpComment = new TCHAR [m_strComment.size() + 1]; _tcscpy(m_nr.lpComment, m_strComment.c_str()); m_nr.lpProvider = new TCHAR [m_strProvider.size() + 1]; _tcscpy(m_nr.lpProvider, m_strProvider.c_str()); } CNETRESOURCE(const CNETRESOURCE& rhs): m_nr(rhs.m_nr), m_strLocalName(rhs.m_strLocalName), m_strRemoteName(rhs.m_strRemoteName), m_strComment(rhs.m_strComment), m_strProvider(rhs.m_strProvider) { m_nr.lpLocalName = new TCHAR [m_strLocalName.size() + 1]; _tcscpy(m_nr.lpLocalName, m_strLocalName.c_str()); m_nr.lpRemoteName = new TCHAR [m_strRemoteName.size() + 1]; _tcscpy(m_nr.lpRemoteName, m_strRemoteName.c_str()); m_nr.lpComment = new TCHAR [m_strComment.size() + 1]; _tcscpy(m_nr.lpComment, m_strComment.c_str()); m_nr.lpProvider = new TCHAR [m_strProvider.size() + 1]; _tcscpy(m_nr.lpProvider, m_strProvider.c_str()); } ~CNETRESOURCE() { delete [] m_nr.lpLocalName; delete [] m_nr.lpRemoteName; delete [] m_nr.lpComment; delete [] m_nr.lpProvider; } public: NETRESOURCE* operator &() {

                              C Offline
                              C Offline
                              Christian Graus
                              wrote on last edited by
                              #14

                              If it's a vector of CNETRESOURCE, then maybe the problem is absence of operator NETRESOURCE in CNETRESOURCE, but to be honest, I'm guessing because I can't test it. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

                              Sonork ID 100.10002:MeanManOz

                              I live in Bob's HungOut now

                              M 1 Reply Last reply
                              0
                              • C Christian Graus

                                If it's a vector of CNETRESOURCE, then maybe the problem is absence of operator NETRESOURCE in CNETRESOURCE, but to be honest, I'm guessing because I can't test it. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001

                                Sonork ID 100.10002:MeanManOz

                                I live in Bob's HungOut now

                                M Offline
                                M Offline
                                Mario M
                                wrote on last edited by
                                #15

                                CNETRESOURCE does have an operator NETRESOURCE...:(( else it would not compile in VC++ 6.0 Thanks for your time. - Mario

                                1 Reply Last reply
                                0
                                • M Mario M

                                  I have modified the post to 'as-is'. And here is the vector class... also you can read again the previous message with 'as-is'... class CSelectComputerNetwork { public: CSelectComputerNetwork(); virtual ~CSelectComputerNetwork(); public: static bool GetDomains(vector >& vecstrDomains); static bool GetServers(const basic_string& strDomain, vector >& vecstrServers); private: //NETRESOURCE structure wrapper used to save text data that freed by WNetEnumClose(_); class CNETRESOURCE { public: CNETRESOURCE(const NETRESOURCE& nr): m_nr(nr) { m_strLocalName = nr.lpLocalName ? nr.lpLocalName : _T(""); m_strRemoteName = nr.lpRemoteName ? nr.lpRemoteName : _T(""); m_strComment = nr.lpComment ? nr.lpComment : _T(""); m_strProvider = nr.lpProvider ? nr.lpProvider : _T(""); m_nr.lpLocalName = new TCHAR [m_strLocalName.size() + 1]; _tcscpy(m_nr.lpLocalName, m_strLocalName.c_str()); m_nr.lpRemoteName = new TCHAR [m_strRemoteName.size() + 1]; _tcscpy(m_nr.lpRemoteName, m_strRemoteName.c_str()); m_nr.lpComment = new TCHAR [m_strComment.size() + 1]; _tcscpy(m_nr.lpComment, m_strComment.c_str()); m_nr.lpProvider = new TCHAR [m_strProvider.size() + 1]; _tcscpy(m_nr.lpProvider, m_strProvider.c_str()); } CNETRESOURCE(const CNETRESOURCE& rhs): m_nr(rhs.m_nr), m_strLocalName(rhs.m_strLocalName), m_strRemoteName(rhs.m_strRemoteName), m_strComment(rhs.m_strComment), m_strProvider(rhs.m_strProvider) { m_nr.lpLocalName = new TCHAR [m_strLocalName.size() + 1]; _tcscpy(m_nr.lpLocalName, m_strLocalName.c_str()); m_nr.lpRemoteName = new TCHAR [m_strRemoteName.size() + 1]; _tcscpy(m_nr.lpRemoteName, m_strRemoteName.c_str()); m_nr.lpComment = new TCHAR [m_strComment.size() + 1]; _tcscpy(m_nr.lpComment, m_strComment.c_str()); m_nr.lpProvider = new TCHAR [m_strProvider.size() + 1]; _tcscpy(m_nr.lpProvider, m_strProvider.c_str()); } ~CNETRESOURCE() { delete [] m_nr.lpLocalName; delete [] m_nr.lpRemoteName; delete [] m_nr.lpComment; delete [] m_nr.lpProvider; } public: NETRESOURCE* operator &() {

                                  T Offline
                                  T Offline
                                  Tim Smith
                                  wrote on last edited by
                                  #16

                                  The two NETRESOURCE operators need to be removed. They will cause all sorts of problems with standard STLs

                                    NETRESOURCE\* operator &() 
                                      {
                                          return &m\_nr;
                                      }
                                  
                                      operator NETRESOURCE() const
                                      {
                                          return m\_nr;
                                      }
                                  

                                  Specificall,y the operator & is causing the problems. The & operator is used heavily in standard STL. When STL applies the & operator, it is expecting a reference to the class, not a NETRESOURCE *, thus the problem. Tim Smith Descartes Systems Sciences, Inc.

                                  M 1 Reply Last reply
                                  0
                                  • T Tim Smith

                                    The two NETRESOURCE operators need to be removed. They will cause all sorts of problems with standard STLs

                                      NETRESOURCE\* operator &() 
                                        {
                                            return &m\_nr;
                                        }
                                    
                                        operator NETRESOURCE() const
                                        {
                                            return m\_nr;
                                        }
                                    

                                    Specificall,y the operator & is causing the problems. The & operator is used heavily in standard STL. When STL applies the & operator, it is expecting a reference to the class, not a NETRESOURCE *, thus the problem. Tim Smith Descartes Systems Sciences, Inc.

                                    M Offline
                                    M Offline
                                    Mario M
                                    wrote on last edited by
                                    #17

                                    Thanks! :), this removes the error, but now I have to find something to replace the operator, since I get this error... SelectComputerNetwork.cpp(58) : error C2664: 'CSelectComputerNetwork::EnumServers' : cannot convert parameter 1 from 'CSelectComputerNetwork::CNETRESOURCE *' to 'NETRESOURCE *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast - Mario

                                    T 1 Reply Last reply
                                    0
                                    • M Mario M

                                      Thanks! :), this removes the error, but now I have to find something to replace the operator, since I get this error... SelectComputerNetwork.cpp(58) : error C2664: 'CSelectComputerNetwork::EnumServers' : cannot convert parameter 1 from 'CSelectComputerNetwork::CNETRESOURCE *' to 'NETRESOURCE *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast - Mario

                                      T Offline
                                      T Offline
                                      Tim Smith
                                      wrote on last edited by
                                      #18

                                      Just make a new routine to get that resource. IMHO, I don't understand why NETRESOURCE was made private when the operator & provided unrestricted access to the member. I would just make NETRESOURCE public and be done with it. Tim Smith Descartes Systems Sciences, Inc.

                                      M 1 Reply Last reply
                                      0
                                      • T Tim Smith

                                        Just make a new routine to get that resource. IMHO, I don't understand why NETRESOURCE was made private when the operator & provided unrestricted access to the member. I would just make NETRESOURCE public and be done with it. Tim Smith Descartes Systems Sciences, Inc.

                                        M Offline
                                        M Offline
                                        Mario M
                                        wrote on last edited by
                                        #19

                                        I will try to make a new routine to get NETRESOURCE, I also made NETRESOURCE & CNETRESOURCE public, but I get the same error... Thanks for your time.

                                        T 1 Reply Last reply
                                        0
                                        • M Mario M

                                          I will try to make a new routine to get NETRESOURCE, I also made NETRESOURCE & CNETRESOURCE public, but I get the same error... Thanks for your time.

                                          T Offline
                                          T Offline
                                          Tim Smith
                                          wrote on last edited by
                                          #20

                                          Yeah, all you will have to do is change those (*ix) to something like (*ix) .m_nr or (*ix) .GetNetResource (). Tim Smith Descartes Systems Sciences, Inc.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups