DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: #import, need help plz

  1. #1
    artois Guest

    #import, need help plz


    I'm new to com dev with vc++6.0. I'm trying to access a compement devlopped
    under vb6. After browsing several exemple, i came to this code :

    #import "GuinAutoNbr.dll" no_namespace
    #include "stdafx.h"

    int main(int argc, char* argv[])
    {

    _MyAutoNbrPtr p;
    return 0;
    }

    VC generated the .tlh and .tli, (my dll is registred and was fully tested
    with a vb simple .exe).

    when i type : p. the IntelliSense pop up and show the thing i can use. (ok
    it seem to work)

    but when i build i got this :

    --------------------Configuration: mynbr - Win32 Debug----------Compiling...
    mynbr.cpp
    C:\comexemple\mynbr\mynbr.cpp(14) : error C2065: '_MyAutoNbrPtr' : undeclared
    identifier
    C:\comexemple\mynbr\mynbr.cpp(14) : error C2146: syntax error : missing ';'
    before identifier 'p'
    C:\comexemple\mynbr\mynbr.cpp(14) : error C2065: 'p' : undeclared identifier
    Error executing cl.exe.

    mynbr.exe - 3 error(s), 0 warning(s)


    I have succefully worked similir thing with #import with another exemple,
    however when i try on my own i fail. I have read the article "Integrate COM
    Components", when i read it, everything is clear but when implement on my
    own it say that so commun vc error "undeclared..." Can someone help me to
    resovle this probleme please


  2. #2
    Marius http://www.planeteer.ca/~zalmoxe Guest

    Re: #import, need help plz


    try
    #include <atlbase.h>


    "artois" <artois_uo@hotmail.com> wrote:
    >
    >I'm new to com dev with vc++6.0. I'm trying to access a compement devlopped
    >under vb6. After browsing several exemple, i came to this code :
    >
    >#import "GuinAutoNbr.dll" no_namespace
    >#include "stdafx.h"
    >
    >int main(int argc, char* argv[])
    >{
    >
    > _MyAutoNbrPtr p;
    > return 0;
    >}
    >
    >VC generated the .tlh and .tli, (my dll is registred and was fully tested
    >with a vb simple .exe).
    >
    >when i type : p. the IntelliSense pop up and show the thing i can use.

    (ok
    >it seem to work)
    >
    >but when i build i got this :
    >
    >--------------------Configuration: mynbr - Win32 Debug----------Compiling...
    >mynbr.cpp
    >C:\comexemple\mynbr\mynbr.cpp(14) : error C2065: '_MyAutoNbrPtr' : undeclared
    >identifier
    >C:\comexemple\mynbr\mynbr.cpp(14) : error C2146: syntax error : missing

    ';'
    >before identifier 'p'
    >C:\comexemple\mynbr\mynbr.cpp(14) : error C2065: 'p' : undeclared identifier
    >Error executing cl.exe.
    >
    >mynbr.exe - 3 error(s), 0 warning(s)
    >
    >
    >I have succefully worked similir thing with #import with another exemple,
    >however when i try on my own i fail. I have read the article "Integrate

    COM
    >Components", when i read it, everything is clear but when implement on my
    >own it say that so commun vc error "undeclared..." Can someone help me to
    >resovle this probleme please
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center