Using a crystal report .tlb file in vS c++ 2008
<p>I am generally new to programming and especially to c++, but I just created a crystal report with c# in vs 2010 and I am trying to import into a short code i have in c++ as a .tlb file. However, I keep getting the following run time errors. I have attached the code for your perusal. I think the import works fine, but the initialization of the interface class is failing - I just want to know if there is something wrong with my code.
The program hangs in the line where i call (m_pMsiOpfRptCOM->SetDataReportDir(LPCTSTR("C:"),      LPCTSTR("C:\Users\Public\Documents\CMPromptData\"));//!!!!!!!)</p>

<ol>
<li>__vfptr  CXX0030: Error: expression cannot be evaluated  </li>
<li><p>Unhandled exception at 0x00c5243a in DpFlowRpt.exe: 0xC0000005: Access violation reading location 0x00000000.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#import "MsiOpfRptViewer.tlb" 


MsiOpfRptViewer::MsiOpfRptCOM_Interface*    m_pMsiOpfRptCOM;


using namespace std;

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

    if (argc &lt; 5) { // Check the value of argc. If not enough parameters have   been passed, inform user and exit.
       cout &lt;&lt; "Usage is -in &lt;infile&gt; -out &lt;outdir&gt;\n"; // Inform the user of how to use the program
       cin.get();
      exit(0);
 } else { // if we got enough parameters...
string strRptDir, strTxtDir; 
int intReportNum;
    cout &lt;&lt; argv[0];
    cout &lt;&lt;"\n" &lt;&lt; argc;
    for (int i = 1; i &lt; argc; i++) { /* We will iterate over argv[] to get the parameters stored inside.
                                  * Note that we're starting on 1 because we don't need to know the 
                                  * path of the program, which is stored in argv[0] */
        if (i + 1 &lt; argc){ // Check that we haven't finished parsing already
            if (strcmp(argv[i],"-f") == 0) {
            // We know the next argument *should* be the filename:
                strRptDir = string(argv[i + 1]);
                cout &lt;&lt; "\nsave it here.\n";
                cout &lt;&lt; strRptDir &lt;&lt; "\n";
                i++;
            }else if (strcmp(argv[i],"-p") == 0) {
                strTxtDir = string(argv[i + 1]);
                cout &lt;&lt; "get input data from here.\n";
                cout &lt;&lt; strTxtDir &lt;&lt; "\n";
                i++;
            }else if (strcmp(argv[i],"-o") == 0) {
                intReportNum = atoi(argv[i + 1]);
                cout &lt;&lt; "Chose this report.\n";
                cout &lt;&lt; intReportNum &lt;&lt; "\n";
                i++;
            }else {
                cout &lt;&lt; "Not enough or invalid arguments, please try again.\n";
                Sleep(2000); 
                exit(0);
        }
        //cout &lt;&lt; argv[i] &lt;&lt; " ";
    }
    }

    // set the report directory
    m_pMsiOpfRptCOM-&gt;SetDataReportDir(LPCTSTR("C:"), LPCTSTR("C:\\Users\\Public\\Documents\\CMPromptData\\"));//!!!!!!!

    // Create and show the reports
    m_pMsiOpfRptCOM-&gt;WriteReport(intReportNum);//!!!!!!!!!
    m_pMsiOpfRptCOM-&gt;ShowReport();//!!!!!!!!!
    //... some more code
    cin.get();
    return 0;
}
</code></pre>

<p>}</p></li>
</ol>
