kohler / click

The Click modular router: fast modular packet processing and analysis
Other
742 stars 321 forks source link

Can make click router include c++ standard library? #193

Open chuanic opened 9 years ago

chuanic commented 9 years ago

I want to create an element which can generate an txt file, the c++ code just as below:

qq

asridharan commented 9 years ago

Only if you are using userlevel click. Kernel module click cannot be compiled with STL.

On Mon, May 18, 2015 at 5:23 AM chuanic notifications@github.com wrote:

I want to create an element which can generate an txt file, the c++ code just as below:

include

using namespace std;

int main () { ofstream out("esp.conf"); int _spi = 234; int _rpl = 300;

out << _spi << endl; out << _rpl << endl;

}

— Reply to this email directly or view it on GitHub https://github.com/kohler/click/issues/193.

chuanic commented 9 years ago

I use userlevel click. My code is as below:

-------------------this is my element code------------------- 01

-------------------this is my running error------------------- 02

asridharan commented 9 years ago

You seem to be hitting the error when you are compiling the linux module. Compile only the userlevel click.

On Mon, May 18, 2015 at 7:33 AM chuanic notifications@github.com wrote:

I use userlevel click. My code is as below:

-------------------this is my element code------------------- [image: 01] https://cloud.githubusercontent.com/assets/4868129/7682882/bf35487c-fdad-11e4-825e-c9dea93da27c.png

-------------------this is my running error------------------- [image: 02] https://cloud.githubusercontent.com/assets/4868129/7682886/c3b2ed6e-fdad-11e4-822e-ab8599fc2d95.png

— Reply to this email directly or view it on GitHub https://github.com/kohler/click/issues/193#issuecomment-103080699.

asridharan commented 9 years ago

You can disable linuxmodule at the toplevel by running the configure as follows:

./configure --enable-userlevel --disable-linuxmodule

On Mon, May 18, 2015 at 7:35 AM Avinash Sridharan < avinash.sridharan@gmail.com> wrote:

You seem to be hitting the error when you are compiling the linux module. Compile only the userlevel click.

On Mon, May 18, 2015 at 7:33 AM chuanic notifications@github.com wrote:

I use userlevel click. My code is as below:

-------------------this is my element code------------------- [image: 01] https://cloud.githubusercontent.com/assets/4868129/7682882/bf35487c-fdad-11e4-825e-c9dea93da27c.png

-------------------this is my running error------------------- [image: 02] https://cloud.githubusercontent.com/assets/4868129/7682886/c3b2ed6e-fdad-11e4-822e-ab8599fc2d95.png

— Reply to this email directly or view it on GitHub https://github.com/kohler/click/issues/193#issuecomment-103080699.

chuanic commented 9 years ago

thank you very much, it works.

but the esp.conf isn't generated and if i use esp.conf file the terminal points out that segment fault.

kohler commented 9 years ago

You could also put

ELEMENT_REQUIRES(userlevel)

on a line by itself at the bottom of the element .cc file.