Skip to content

Will get cannot declare pointer to error When include httplib.h #2278

@Asa-gc

Description

@Asa-gc

when code like:

#include <iostream>
#include <string>
#include "httplib.h"

int func(int &_res){
    return 0;
}

int main(int argc, char *argv[])
{
    return 0;
}

will get this error:

error: cannot declare pointer to ‘int&’
[build]     5 | int func(int &_res){
[build]       |               ^~~~

The inspection found that it was because these code in <resolv.h>:159

__BEGIN_DECLS
extern struct __res_state *__res_state(void) __attribute__ ((__const__));
__END_DECLS
#define _res (*__res_state())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions