INTELLISENSE: class "Initialize" has no member "SendCom"

Discussion in 'Visual C++ .Net' started by DN Admin, Apr 25, 2012.

  1. DN Admin

    Staff Member

    Country:
    United States
    Joined:
    Aug 7, 2010
    Location:
    Joliet, IL U.S.A.
    Hi! I am totally stumped, I have written the following codes using Unmanaged C++, a dll file which i have linked to an Exe file:
    this is ControlCF30.cpp
    <pre class="prettyprint // ControlCF30.cpp : Defines the exported functions for the DLL application.
    //

    #include "stdafx.h"
    #include "ftd2xx.h"
    #include "ControlCF30.h"
    #include <WinDef.h>
    #include <Windows.h>
    #include <stdint.h>
    #include <strsafe.h> //for stringcbprintfa


    //LPDWORD dwBytesReturned = new DWORD();
    //LPDWORD dwBytesWritten = new DWORD();
    DWORD dwBytesWritten = 0; //used for LPDWORD
    DWORD dwBytesReturned = 0; //used for LPDWORD
    //

    int Initialize :: Scan() //scans and opens the device.
    {
    //Initialize *obj1= new Initialize;

    DWORD dwNumDevs;
    //FT_STATUS FT_OpenEx;
    int iCount=0;
    FT_HANDLE m_ftHandle;
    int m_i64ComboBoxDeviceIDs[]={iCount};
    FT_STATUS ftStatus;
    FT_DEVICE_LIST_INFO_NODE *devInfo ;
    //
    // create the device information list
    ftStatus = FT_CreateDeviceInfoList(&dwNumDevs);
    if (ftStatus == FT_OK)
    {
    if(dwNumDevs > 0)
    {
    devInfo = new FT_DEVICE_LIST_INFO_NODE[dwNumDevs];
    if(devInfo)
    {
    ftStatus = FT_GetDeviceInfoList(devInfo,&dwNumDevs);
    if (ftStatus == FT_OK)
    {
    for(iCount = 0; iCount < (int) dwNumDevs; iCount++)
    {
    m_i64ComboBoxDeviceIDs[iCount] =(__int64) devInfo[iCount].SerialNumber;

    ftStatus = FT_OpenEx(devInfo[iCount].SerialNumber,FT_OPEN_BY_SERIAL_NUMBER,&m_ftHandle);

    }}}}}
    return 0;
    };

    int Initialize :: SendCom() //to send an ascii command-starts the TX-RX
    {
    FT_STATUS ftstatus;
    FT_HANDLE m_ftHandle;
    int iVel;
    char szBufferWrite[40];
    char szBufferRead[40];

    StringCbPrintfA(szBufferWrite,sizeof(szBufferWrite),"PV,1,%dr", iVel );
    ftstatus = FT_Purge (m_ftHandle, FT_PURGE_TX | FT_PURGE_RX );// _TX - out // _RX - in
    ftstatus = FT_Write(m_ftHandle,szBufferWrite,(DWORD)strlen(szBufferWrite),&dwBytesWritten);

    ftstatus = FT_Read (m_ftHandle,szBufferRead,12,&dwBytesReturned);

    return 0;
    };





    //int main()
    //{
    // /*Initialize objScan,objOpen;
    // objScan.Scan();*/
    //
    //
    //
    ////Initialize * obj1 = new Initialize();
    // /*if( !obj1->Init() )
    // {
    //
    // }*/
    // return 0;
    //
    //
    //}</pre>
    this is the ControlCF30.h
    <pre class="prettyprint #pragma once

    #define ControlCF30_EXPORTS 1

    #ifdef ControlCF30_EXPORTS
    #define ControlCF30_API __declspec(dllexport)
    #else
    #define ControlCF30_API __declspec(dllimport)
    #endif

    //typedef tagxyzHANDLE {} * XYZHANDLE;

    class ControlCF30_API Initialize
    {

    public: int Scan();
    public: int Close();
    public: int SendCom();
    public: Initialize(void){};
    public: ~Initialize(void){};
    bool Init();
    };</pre>
    this code is for the exe file:
    <pre class="prettyprint // ExeScan.cpp : Defines the entry point for the console application.
    //

    #include "stdafx.h"
    #include "ControlCF30.h"
    //#include "ftd2xx.h"

    int main()
    {
    Initialize ObjScan,ObjTxRx;
    ObjScan.Scan(); // this function works perfectly fine. ObjTxRx.SendCom(); //this is where i get the error where it says <class "Initialize" has no member "SendCom" >

    } </pre>
    ControlCF30 is linked with ExeScan. ControlCF30 include FTD2XX lib file and header.
    As for linking: I have linked both the files i.e. ControlCF30 and ExeScan using the project properties;
    C/C++ -> General-> Additional Include Directories
    Linker -> General -> Additional Library Directories
    Linker -> Input -> Additional Dependencies
    I have also placed the .dll , .lib and obj files of ControlCF30 in the Exescan's Appropriate folders i.e. (debug and main folder).
    If you will notice, Scan() works perfectly fine, it has also been used the same way as i intend to use SendCom(), but i get the error only with SendCom().


    **IMPORTANT** ->Another Funny thing about this project file is: when i comment out the SendCom() function and the related calls to this functions and build the solution, i get a linking error 2019 for the Scan(). And if i build the solution with the SendCom()
    i only get the error 2039 i.e. class "Initialize" has no member "SendCom".
    I am new to all this i might be commiting a silly mistake or overlooking something, please let me know. Thanks in advance!!
    <br/>
    <br/>

    View the full article
     
    #1

Share This Page