c++ - token "<"之前的错误预期标识符

标签 c++ c++11 syntax-error structure shared-data

我是 C++ 的初学者。我有一个名为 SharedData.h 的头文件。它在下面给出。

//SharedData.h

#include <memory>

typedef struct Shared_data
{
    std::string _data;
    bool IsConsumedbyNodeA;
    bool IsConsumedbyNodeB;

public:
    Shared_data():
        tokenizer_data(""),IsConsumedbyNodeA(false),IsConsumedbyNodeB(false){};
    Shared_data& ReadSharedData();
    void WriteSharedData(Shared_data &);
}Shared_data;

extern std::shared_ptr<Shared_data> ptr_to_Shared_data;//I am getting the above mentioned error here

shared_ptr 是在 Shared_data.cpp 中定义的,这样我就可以在包含 header 的任何地方获得内存中对象的单个拷贝和外部声明。

我尝试了很多,但不知道如何解决这个错误。

请帮忙......

问候, 技术人员

最佳答案

您需要包含 header 内存

关于c++ - token "<"之前的错误预期标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21828603/

相关文章:

c# - 使用System.Windows;不是名字空间

compiler-errors - “'附近” : syntax error

c++ - 将日志记录插入项目中每个函数的脚本?

c++ - 在 QT Creator 中如何将 CGAL 包含到 QT 项目中?

c++ - 标记 SIC 汇编程序源代码

c++ - 在 C++ 中的重复 vector 中查找单个 int

c++ - c++14中std::string的运算符后缀

c++ - 如何从 VC++ 2010 中的 std::regex 获取带有模式的字符串

c++ - 如何将指针传递给对象方法?

flash - 救命! Actionscript中令人困惑的语法错误1084,要求使用分号?