CESNET / libnetconf2

C NETCONF library
BSD 3-Clause "New" or "Revised" License
203 stars 147 forks source link

undefined reference to nc_new_session #330

Closed sangamesh82 closed 3 years ago

sangamesh82 commented 3 years ago

Hello,

I have started using this tool recently and have went through the tests folder and the examples in it. Started with a sample call home test. I have added the necessary C_INCLUDE_PATH and LD_LIBRARY_PATH, but I get error at linking time for 'nc_new_session' as undefined reference. The header file session_p.h from the src folder has been added and .I option is used as part of GCC.

Please let me know how to solve this and if I need to provide more information, please let me know.

wwr, Sangamesh

michalvasko commented 3 years ago

nc_new_session is not a public function and session_p.h is not a public header so I am not sure what exactly you are doing but it is wrong. You are meant to include only nc_client.h if implementing a NETCONF client and nc_server.h if implementing a server.

sangamesh82 commented 3 years ago

Hello Michal,

Got it, thanks.

I am implementing the NETCONF client with call home and other NETCONF features, and was referring the code examples from the tests folder, so I used the nc_new_session and session_p.h files.

wwr, Sangamesh

michalvasko commented 3 years ago

The best example of a libnetconf2 NETCONF client there is is netopeer2-cli. But it is quite simple so you will have to look at all the public functions and the general documentation.

sangamesh82 commented 3 years ago

Oh ok, I have not looked at this, I will use it as a reference. It is cli based, and I want to build NETCONF client as a C API based.

I am looking at https://netopeer.liberouter.org/doc/libnetconf2/devel/html/howto.html documentation.

sangamesh82 commented 3 years ago

Is there any other documentation that I need to look at ?

michalvasko commented 3 years ago

No, there is no other.

sangamesh82 commented 3 years ago

Thanks for the information Michal, will get started with my activities and will get back to you accordingly.