ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

include standard raspberry pi library to ros hydro

asked 2014-10-01 07:20:40 -0500

bluhub gravatar image

Hey all,

I've got a problem concerning the standard raspberry libraries. I'm trying to receive sensor data via a sensor shield specialized for raspberry pi and for that purpose the already succesfully included header-files are depending on +20 preinstalled raspberry libraries:

#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <string.h>
#include <time.h>
#include <termios.h> 
#include <ctype.h>
#include <sys/ioctl.h>
#include <limits.h>
#include <algorithm>
#include <limits.h>
#include <pthread.h>
#include <poll.h>

So my question is now: Is there a fast and easy way to link/use these libraries or do I really have to wrap them all seperately?

Best Regards

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-10-01 15:30:35 -0500

tfoote gravatar image

Most of those are part of the standard library or stl and you won't have to link them explicitly. Some you will need to link explicitly like pthread. For example: https://stackoverflow.com/questions/1...

edit flag offensive delete link more

Comments

can you provide a list or a source, where I can look up the libraries, that I have to link explicitly? or just trial and error..?

bluhub gravatar image bluhub  ( 2014-10-02 03:09:43 -0500 )edit

These are all from system libraries or the stl. you should look up what packages they come from and familiarize yourself with them and standard usage of them from their documentation. Googling each of them will give you a lot of information.

tfoote gravatar image tfoote  ( 2014-10-02 03:34:03 -0500 )edit

Undefined references are linking issues. You need to make sure you're linking against all the libraries you're using. I suggest looking at some more general references. This is not really a ROS question.

tfoote gravatar image tfoote  ( 2014-10-02 12:34:04 -0500 )edit
0

answered 2014-10-02 10:26:31 -0500

bluhub gravatar image

updated 2014-10-02 10:26:54 -0500

ok thank you, but I haven't made any progress yet and I'm still new to these things, so it's giving me a really hard time. I dont need to use the stated libraries right now. All I need to use, are the function defined by file1.h/file1.cpp. In order to fully recognize all sensors connected to the sensor shield, file1 includes another header-file file2.h and this header-file file2 includes all the above stated header files!

So far I added following lines to the CMakeLists:

add_executable(file1 src/file1.cpp)
add_executable(file2 src/file2.cpp)
target_link_library(file1 ${catkin_LIBRARIES})
target_link_library(file2 ${catkin_LIBRARIES})

So now all functions specified within the header-files file1/file2 are identified correctly, but the reference to the underlying included header-files is missing and I'm receiving a hell of a lot of undefined references. I tried several ways after reading through CMake tutorials and other stuff (i.e. including the directory to the inluded header-files in CMakeLists etc.).. Am I missing something?

edit flag offensive delete link more

Comments

Please don't use answer areas for modifying your question. Please edit your question for more clarifications.

tfoote gravatar image tfoote  ( 2014-10-02 12:31:44 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-10-01 07:20:40 -0500

Seen: 773 times

Last updated: Oct 02 '14