vscode开发OOPC出现问题

求各位指点

img

img

img

lw_oopc.h文件

// Copyright (C) 2008,2009,2010 by Tom Kao & MISOO Team & Yonghua Jin. All rights reserved.
// Released under the terms of the GNU Library or Lesser General Public License (LGPL).
// Author: Tom Kao(中文名:高焕堂),MISOO 团队,Yonghua Jin(中文名:金永华)

#ifndef LW_OOPC_H_
#define LW_OOPC_H_

#include 

// 配置宏(两种配置选其一):
#define LW_OOPC_USE_STDDEF_OFFSETOF     // 表示使用C标准定义的offsetof
// #define LW_OOPC_USE_USER_DEFINED_OFFSETOF // 表示使用用户自定义的lw_oopc_offsetof宏

// 是否支持内存泄露检测,缺省不支持
// #define LW_OOPC_SUPPORT_MEMORY_LEAK_DETECTOR

// 是否支持调试信息打印(内存分配和释放的详细信息),缺省关闭打印
// #define LW_OOPC_PRINT_DEBUG_INFO

#ifdef LW_OOPC_USE_STDDEF_OFFSETOF
#include 
#define LW_OOPC_OFFSETOF offsetof
#endif

#ifdef LW_OOPC_USE_USER_DEFINED_OFFSETOF
// 有些环境可能不支持,不过,这种情形极少出现
#define LW_OOPC_OFFSETOF(s,m) (size_t)&(((s*)0)->m)
#endif

typedef int lw_oopc_bool;
#define lw_oopc_true    (1)
#define lw_oopc_false    (0)

#ifdef LW_OOPC_SUPPORT_MEMORY_LEAK_DETECTOR

void* lw_oopc_malloc(size_t size, const char* type, const char* file, int line);
void lw_oopc_free(void* memblock);
void lw_oopc_report();

#define lw_oopc_file_line   __FILE__, __LINE__
#define lw_oopc_file_line_params const char* file, int line
#define lw_oopc_delete lw_oopc_free

#else

void lw_oopc_report();

#define lw_oopc_file_line
#define lw_oopc_file_line_params
#define lw_oopc_free free
#define lw_oopc_delete lw_oopc_free

#endif

#define INTERFACE(type)             \
typedef struct type type;           \
void type##_ctor(type* t);          \
int type##_dtor(type* t);           \
struct type

#define ABS_CLASS(type)             \
typedef struct type type;           \
void type##_ctor(type* t);          \
int type##_dtor(type* t);           \
void type##_delete(type* t);        \
struct type

#define CLASS(type)                 \
typedef struct type type;           \
type* type##_new(lw_oopc_file_line_params); \
void type##_ctor(type* t);          \
int type##_dtor(type* t);           \
void type##_delete(type* t);        \
struct type

#ifdef LW_OOPC_SUPPORT_MEMORY_LEAK_DETECTOR
#define CTOR(type)                                      \
    type* type##_new(const char* file, int line) {      \
    struct type *cthis;                                 \
    cthis = (struct type*)lw_oopc_malloc(sizeof(struct type), #type, file, line);   \
    if(!cthis)                                          \
    {                                                   \
        return 0;                                       \
    }                                                   \
    type##_ctor(cthis);                                 \
    return cthis;                                       \
}                                                       \
                                                        \
void type##_ctor(type* cthis) {
#else
#define CTOR(type)                                      \
    type* type##_new() {                                \
    struct type *cthis;                                 \
    cthis = (struct type*)malloc(sizeof(struct type));  \
    if(!cthis)                                          \
    {                                                   \
        return 0;                                       \
    }                                                   \
    type##_ctor(cthis);                                 \
    return cthis;                                       \
}                                                       \
                                                        \
void type##_ctor(type* cthis) {
#endif

#define END_CTOR    }

#define DTOR(type)                  \
void type##_delete(type* cthis)     \
{                                   \
        if(type##_dtor(cthis))      \
        {                           \
                lw_oopc_free(cthis);\
        }                           \
}                                   \
int type##_dtor(type* cthis)        \
{

#define END_DTOR }

#define ABS_CTOR(type)              \
void type##_ctor(type* cthis) {

#define END_ABS_CTOR }

#define FUNCTION_SETTING(f1, f2)    cthis->f1 = f2;

#define IMPLEMENTS(type)    struct type type

#define EXTENDS(type)        struct type type

#define SUPER_PTR(cthis, father) ((father*)(&((cthis)->father)))

#define SUPER_PTR_2(cthis, father, grandfather) \
    SUPER_PTR(SUPER_PTR(cthis, father), grandfather)

#define SUPER_PTR_3(cthis, father, grandfather, greatgrandfather) \
    SUPER_PTR(SUPER_PTR_2(cthis, father, grandfather), greatgrandfather)

#define SUPER_CTOR(father) \
    father##_ctor(SUPER_PTR(cthis, father));

#define SUB_PTR(selfptr, self, child) \
    ((child*)((char*)selfptr - LW_OOPC_OFFSETOF(child, self)))

#define SUB_PTR_2(selfptr, self, child, grandchild) \
    SUB_PTR(SUB_PTR(selfptr, self, child), child, grandchild)

#define SUB_PTR_3(selfptr, self, child, grandchild, greatgrandchild) \
    SUB_PTR(SUB_PTR_2(selfptr, self, child, grandchild), grandchild, greatgrandchild)

#define INHERIT_FROM(father, cthis, field)    (cthis)->father.field

#endif




已解决,谢谢各位。是extern void* Number_new();的类型不对,不能够使用void类型,应该使用Number这个类来定义。

Namber_new这个函数有问题,,应该是引用的时候出现了问题,查一下在哪里使用了,然后注释掉再运行看一下是否还会报错