Skip to content

Add to a C++ app #12

Description

@bellirodrigo2

I'm trying to add libae in a C++ project, using CMAKE
But, the ae_epoll.c (as well as evport, kqueue, select) header files are causing some issues in the make:

My CMAKE:
cmake_minimum_required(VERSION 3.17)
project(dynbe)

set(CMAKE_CXX_STANDARD 14)

set(libae "src/libae/ae.h" "src/libae/ae.c" "src/libae/anet.h" "src/libae/anet.c"
"src/libae/ae_evport.c" "src/libae/ae_epoll.c" "src/libae/ae_kqueue.c"
"src/libae/ae_select.c" "src/libae/config.h" "src/libae/fmacros.h"
"src/libae/zmalloc.h")

add_library(ae STATIC ${libae})

add_executable(dynbe main.cpp src/libs/SingleBehavior.h src/libs/EchoServer.h
src/Behavior.h src/FdEventProc.h)

target_link_libraries(dynbe ae)

Error I get when CMAKE

/home/ubung/C_C++/C++/dynbe/src/libae/ae_evport.c:33:10: fatal error: port.h: No such file or directory
#include <port.h>
^~~~~~~~
compilation terminated.
CMakeFiles/ae.dir/build.make:108: recipe for target 'CMakeFiles/ae.dir/src/libae/ae_evport.c.o' failed

make[2]: *** [CMakeFiles/ae.dir/src/libae/ae_evport.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....

/home/ubung/C_C++/C++/dynbe/src/libae/ae_kqueue.c:33:10: fatal error: sys/event.h: No such file or directory
#include <sys/event.h>
^~~~~~~~~~~~~
compilation terminated.
CMakeFiles/ae.dir/build.make:134: recipe for target 'CMakeFiles/ae.dir/src/libae/ae_kqueue.c.o' failed

make[2]: *** [CMakeFiles/ae.dir/src/libae/ae_kqueue.c.o] Error 1
/home/ubung/C_C++/C++/dynbe/src/libae/ae_select.c:42:24: error: unknown type name ‘aeEventLoop’
static int aeApiCreate(aeEventLoop *eventLoop) {
^~~~~~~~~~~
/home/ubung/C_C++/C++/dynbe/src/libae/ae_select.c:52:24: error: unknown type name ‘aeEventLoop’
static int aeApiResize(aeEventLoop *eventLoop, int setsize) {
^~~~~~~~~~~
/home/ubung/C_C++/C++/dynbe/src/libae/ae_select.c:58:23: error: unknown type name ‘aeEventLoop’
static void aeApiFree(aeEventLoop *eventLoop) {
^~~~~~~~~~~
/home/ubung/C_C++/C++/dynbe/src/libae/ae_select.c:62:26: error: unknown type name ‘aeEventLoop’
static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
^~~~~~~~~~~
/home/ubung/C_C++/C++/dynbe/src/libae/ae_select.c:70:27: error: unknown type name ‘aeEventLoop’
static void aeApiDelEvent(aeEventLoop *eventLoop, int fd, int mask) {
^~~~~~~~~~~
/home/ubung/C_C++/C++/dynbe/src/libae/ae_epoll.c:38:24: error: unknown type name ‘aeEventLoop’
static int aeApiCreate(aeEventLoop *eventLoop) {
^~~~~~~~~~~
/home/ubung/C_C++/C++/dynbe/src/libae/ae_select.c:77:22: error: unknown type name ‘aeEventLoop’
static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
^~~~~~~~~~~
/home/ubung/C_C++/C++/dynbe/src/libae/ae_epoll.c:57:24: error: unknown type name ‘aeEventLoop’
static int aeApiResize(aeEventLoop *eventLoop, int setsize) {
^~~~~~~~~~~
/home/ubung/C_C++/C++/dynbe/src/libae/ae_epoll.c:64:23: error: unknown type name ‘aeEventLoop’
static void aeApiFree(aeEventLoop *eventLoop) {
^~~~~~~~~~~
/home/ubung/C_C++/C++/dynbe/src/libae/ae_epoll.c:72:26: error: unknown type name ‘aeEventLoop’
static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
^~~~~~~~~~~
CMakeFiles/ae.dir/build.make:147: recipe for target 'CMakeFiles/ae.dir/src/libae/ae_select.c.o' failed
make[2]: *** [CMakeFiles/ae.dir/src/libae/ae_select.c.o] Error 1
/home/ubung/C_C++/C++/dynbe/src/libae/ae_epoll.c:89:27: error: unknown type name ‘aeEventLoop’
static void aeApiDelEvent(aeEventLoop *eventLoop, int fd, int delmask) {
^~~~~~~~~~~
/home/ubung/C_C++/C++/dynbe/src/libae/ae_epoll.c:107:22: error: unknown type name ‘aeEventLoop’
static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
^~~~~~~~~~~

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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