Код: Выделить всё
// c_enum.h
#pragma once
typedef enum { val1 = 0 } c_style_enum_t;
c_style_enum_t c_func();
< /code>
// my_class.hpp
#pragma once
extern "С" {
#include "c_enum.h"
}
class my_class {
public:
private:
friend c_style_enum_t ::c_func();
};
< /code>
gcc напечатает ошибку: < /p>
error: 'enum c_style_enum ' is not a class or namespace
142 | friend c_style_enum ::c_func();
error: ISO C++ forbids declaration of 'c_func' with no type [-fpermissive]
Как сделать эту работу?
Подробнее здесь: https://stackoverflow.com/questions/794 ... eturn-type