zoukankan      html  css  js  c++  java
  • 使用C++.NET常见问题汇总

    问题1.: fatal error C1083: 无法打开包含文件:“iostream.h”: No such file or directory
      解决办法:
        将 #include 
    "iostream.h"                      //(vc++6.0)
        替换为:                                                //(vc++7.0 /vc++.net)                       
            #include "IOSTREAM"  // 包含流的旧式头文件 //使用旧的iostream头文件不要加.h
            using namespace std;                     //另需添加部分
    PLCHandler.obj : error LNK2001: unresolved external symbol "public: bool __thiscall PLCDB90::read(long,long,long * const)" (?read@PLCDB90@@QAE_NJJQAJ@Z)
    PLCHandler.obj : error LNK2001: unresolved external symbol 
    "public: bool __thiscall PLCDB80::read(long,long,long * const)" (?read@PLCDB80@@QAE_NJJQAJ@Z)
    bin
    /PlcOperation.exe : fatal error LNK1120: 2 unresolved externals
    在plcdb90.cpp文件中没有对其实现
    PLCDB90::read(
    long,long,long * const)

    2*****************
    问题:
    --------------------Configuration: DataTrans - Win32 Debug--------------------
    Compiling
    DataTrans.cpp
    D:\VC60Projects\DataTrans\DataTrans.cpp(
    22) : error C2065: 'cout' : undeclared identifier
    D:\VC60Projects\DataTrans\DataTrans.cpp(
    22) : error C2297: '<<' : illegal, right operand has type 'char [4]'
    D:\VC60Projects\DataTrans\DataTrans.cpp(
    22) : error C2065: 'endl' : undeclared identifier
    D:\VC60Projects\DataTrans\DataTrans.cpp(
    23) : warning C4552: '<<' : operator has no effect; expected operator with side-effect
    PLCHandler.cpp
    DataHelper.cpp
    Generating Code
    Error executing cl.exe.

    DataTrans.exe 
    - 3 error(s), 1 warning(s)

    //****************************************************
    解决:

    在project setting里面的 c
    /c++ 选项卡 

    在combo里面找到 precompiled header 

    选择 no precompiled header 即可 


    3***********************
    bool bflag型 
    bool 应大写为 BOOL

    4***********************
    c1.h,c2.h 头文件的互相包含
    c1.h中写上#include 
    "c2.h",class c2;
    c2.h中同样如此.

    5*******************************
    d:\shengwuproject\
    0911\dbcallback.cpp(15) : error C2371: 'public: static class PLC * cTestCallBack::pLCDB902' : redefinition; different basic types
            d:\shengwuproject\
    0911\dbcallback.h(34) : see declaration of 'public: static class PLC * cTestCallBack::pLCDB902'
    PLC 
    *cTestCallBack::pLCDB902;  //静态变量声明
    前面声明的类型plc和后面的*cTestCallBack::pLCDB902变量类型plcdb90不一样.


    6=============================
    已经包含了#include   
    <process.h>头文件,编译时仍然说'_beginthread'   undeclared   identifier
    解决:
    根据下列步骤进行设置.
    project
    ->settings->c/c++:   
      Category:Code   Generation   
      Use   run
    -time   library:   
      debug   version:   
      Debug   Multithread   DLL   
      release   version:   
        Multithread   DLL 

    7==============================
    问题:
    PLCDB90.obj : error LNK2001: unresolved external symbol 
    "class ATL::CComModule _Module" (?_Module@@3VCComModule@ATL@@A)
    bin
    /PlcOperation.exe : fatal error LNK1120: 1 unresolved externals
    解决:
     添加ATL头文件
    使用ATL前必须包含以下头文件:atlbase.h和atlcom.h,并且定义_Module变量[
    2]。把以下代码加到stdafx.h是最方便的:
    #include 
    <atlbase.h>
    extern CComModule _Module;
    #include 
    <atlcom.h> 
    在cpp文件中要对_Module进行定义。如下: 
    CcomModule _Module;
    在添加了这两行之后,我们就可以使用ATL的功能了。而不必创建ATL的项目。
    当然,如果项目是通过ATL项目向导产生的就不必再次添加头文件了。
    http:
    //www.jr163.org/cup2/18/18781.htm
    8===================================
    问题:
    在MFC(界面)下调用PLC com组件,能响应Com回调dataChange事件,在控制台程序则不能.
    原因:
    因为COM利用消息机制来实现STA,因此STA套间里的线程必须实现消息循环,否则COM将不能实现STA的要求。
    解决:
    在程序中加入:
    #include 
    <windows.h>
    // Main message loop:
    MSG msg;
    while/if(GetMessage(&msg, NULL, 00)) 
    {
    // TranslateMessage(&msg);
    DispatchMessage(&msg);
    }

    http:
    //blog.csdn.net/lop5712/archive/2004/04/05/21360.aspx

     

    未完侍续.
  • 相关阅读:
    leetcode 之Binary Tree Postorder Traversal
    关于java中this的一些总结
    Javascript的匿名函数与自执行
    js 闭包学习笔记
    滚动条到底自动加载数据
    AMD:异步模块定义
    Sass、LESS 和 Stylus
    【原创】Mysql设置自增长主键的初始值
    -webkit-animation的使用
    CSS滤镜
  • 原文地址:https://www.cnblogs.com/furenjun/p/360834.html
Copyright © 2011-2022 走看看