可以啊.
直接maa_strRXData="dfkdfj";

解决方案 »

  1.   

    那我的程序为什么报错呢?
    --------------------Configuration: mypaintline - Win32 Debug--------------------
    Linking...
    mypaintlineDlg.obj : error LNK2005: "public: static class CString CPublic::maa_strRXData" (?maa_strRXData@CPublic@@2VCString@@A) already defined in mypaintline.obj
    Public.obj : error LNK2005: "public: static class CString CPublic::maa_strRXData" (?maa_strRXData@CPublic@@2VCString@@A) already defined in mypaintline.obj
    Debug/mypaintline.exe : fatal error LNK1169: one or more multiply defined symbols found
    执行 link.exe 时出错.
      

  2.   

    编译能通过,但build 时就出现连接错误:error LNK2005: "public: static class CString CPublic::maa_strRXData"
      

  3.   

    啊,楼主的静态变量是类的静态变量.
    那就这样用:
    CPublic::maa_strRXDate = "...";
      

  4.   

    谢谢你共享的那篇文章。你是在类内定义的static变量吗?我今天刚好也调了这个程序,我们这边有人帮我在public.cpp的文件里加了句#include "stdafx.h"就好了,你看看能解决吗?
      

  5.   

    我不知道你错在哪里,你可以参考一下我的程序,调试无误fish.h文件#ifndef MY_FISH
    #define MY_FISH
    class fish
    {
    public:
    static CString eatt;
    public:
    static void eat();
    };
    #endif
    fish.cpp文件#include "stdafx.h"
    #include "fish.h"CString fish::eatt="4kl9437493749";
    void fish::eat()
    {

    }在C*App.h文件头加上 include "fish.h"
    就可以在任何一个*.cpp中使用
    fish::eatt;
    fish::eat();