Re: How to use libev in C Plus Plus

2017-06-27 Thread Marc Lehmann
Hi!

On Mon, Jun 26, 2017 at 03:22:04PM +0800, "liu...@shinezone.com" 
 wrote:
>   ev::dynamic_loop loop;

> I got these error when I compiled this program. If you have free time please 
> answer me why I got these error. Thank you...

While ev++.h has some loop structs, they are undocumented - you have to
limit yourself to the documented API, i.e. mostly the ev::watcher types,
and the normal C API (which is available after including ev++.h).

-- 
The choice of a   Deliantra, the free code+content MORPG
  -==- _GNU_  http://www.deliantra.net
  ==-- _   generation
  ---==---(_)__  __   __  Marc Lehmann
  --==---/ / _ \/ // /\ \/ /  schm...@schmorp.de
  -=/_/_//_/\_,_/ /_/\_\

___
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/mailman/listinfo/libev

How to use libev in C Plus Plus

2017-06-27 Thread liu...@shinezone.com
#include "ev++.h"

#include 
#include 
#include 

ev::io io;

class MyClass
{
public:

  MyClass() {}

  ~MyClass() {}

public:

  void stdin_cb(ev::io , int revents)
  {
puts("stdin ready");
io.stop();
  }
};

int main(int argc, char *argv[])
{
  MyClass my_class;
  ev::dynamic_loop loop;

  io.set(_class);
  io.set(0, EV_READ);
  //io.set(loop);

  //loop.run();

  return 0;
}

gcc -g -std=c++11 -L../libs -lev -Wl,-rpath,../libs -I../deps/libev test.cpp -o 
test

I got these error when I compiled this program. If you have free time please 
answer me why I got these error. Thank you...

/tmp/ccPE4ERN.o:在函数‘ev::bad_loop::bad_loop()’中:
/home/liukai2/legend_sdk/examples/../deps/libev/ev++.h:121:对‘std::runtime_error::runtime_error(char
 const*)’未定义的引用
/tmp/ccPE4ERN.o:在函数‘ev::dynamic_loop::dynamic_loop(unsigned int)’中:
/home/liukai2/legend_sdk/examples/../deps/libev/ev++.h:359:对‘__cxa_allocate_exception’未定义的引用
/home/liukai2/legend_sdk/examples/../deps/libev/ev++.h:359:对‘__cxa_throw’未定义的引用
/home/liukai2/legend_sdk/examples/../deps/libev/ev++.h:359:对‘__cxa_free_exception’未定义的引用
/home/liukai2/legend_sdk/examples/../deps/libev/ev++.h:355:对‘__cxa_call_unexpected’未定义的引用
/tmp/ccPE4ERN.o:在函数‘ev::dynamic_loop::~dynamic_loop()’中:
/home/liukai2/legend_sdk/examples/../deps/libev/ev++.h:362:对‘__cxa_call_unexpected’未定义的引用
/tmp/ccPE4ERN.o:(.rodata._ZTVN2ev8bad_loopE[_ZTVN2ev8bad_loopE]+0x20):对‘std::runtime_error::what()
 const’未定义的引用
/tmp/ccPE4ERN.o:在函数‘ev::bad_loop::~bad_loop()’中:
/home/liukai2/legend_sdk/examples/../deps/libev/ev++.h:114:对‘std::runtime_error::~runtime_error()’未定义的引用
/tmp/ccPE4ERN.o:在函数‘ev::bad_loop::~bad_loop()’中:
/home/liukai2/legend_sdk/examples/../deps/libev/ev++.h:114:对‘operator 
delete(void*)’未定义的引用
/tmp/ccPE4ERN.o:(.rodata._ZTIN2ev8bad_loopE[_ZTIN2ev8bad_loopE]+0x0):对‘vtable 
for __cxxabiv1::__si_class_type_info’未定义的引用
/tmp/ccPE4ERN.o:(.rodata._ZTIN2ev8bad_loopE[_ZTIN2ev8bad_loopE]+0x10):对‘typeinfo
 for std::runtime_error’未定义的引用
/tmp/ccPE4ERN.o:(.eh_frame+0x8b):对‘__gxx_personality_v0’未定义的引用
collect2: error: ld returned 1 exit status



liu...@shinezone.com
___
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/mailman/listinfo/libev