gpt4 book ai didi

c++ - Typedef重定义错误

转载 作者:行者123 更新时间:2023-12-02 11:13:13 26 4
gpt4 key购买 nike

我在Android上使用JNI进行操作,并且尝试执行以下操作:

Foo.h :

class jobject; //error here!

class Foo {
void dowork(const jobject&);
}

Foo.cpp :
#include <jni.h>
:
:
Foo::dowork(const jobject& obj)
{
//Do something
}

我看到 this有类似的东西,但我认为我的情况不同。我没有在匿名结构上的typedef,但在命名结构上。如果我们看到文件 jni.h
typedef _jobject*       jobject;

here:
class _jobject {};

最佳答案

您基本上是在这样做:

typedef int* Foo;   // typedefing Foo to int*

class Foo // attempt to declare a class with a name already used for typedef
{
};

关于c++ - Typedef重定义错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44586813/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com