Ask Your Question

Force rosmake to use parameters?

asked 2014-03-11 22:21:10 -0500

Mokona gravatar image

updated 2016-10-24 08:36:22 -0500

ngrennan gravatar image

Hi! I'm trying to to use threading in RosAria.cpp, but I need to compile the cpp file using: "g++ thread.cpp -pthread -std=c++11 -Wl,--no-as-needed". How can I force rosmake to include the parameter "-pthread -std=c++11 -Wl,--no-as-needed" when compiling? I need to thread this way because I'm using cin to ask for user input, and the other thread needs to check sensor inputs and control the robot based on this. Cin is blocking/waiting for user input and can therefore not run on the same thread AFAIK.

edit retag flag offensive close merge delete


You could also create a client node that gets the user input and perform the control, rather than modifying the rosaria driver node.

ReedHedges gravatar image ReedHedges  ( 2014-03-14 06:34:50 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-03-13 02:43:04 -0500

Wolf gravatar image

updated 2014-03-13 07:52:08 -0500

if you use catkin_make you can add compiler flags (as with cmake) via command line (not sure whether this is possible with rosmake):

catkin_make -DCMAKE_CXX_FLAGS=-pthread\ -std=c++11\ -Wl,--no-as-needed -DCMAKE_C_FLAGS=-pthread\ -std=c++11\ -Wl,--no-as-needed

Note that you need to escape the spaces.

Or you can set them in your CMakeLists.txt (works for both, catkin and rosmake):

set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++11 -Wl,--no-as-needed" ) 
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -std=c++11 -Wl,--no-as-needed" )


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2014-03-11 22:21:10 -0500

Seen: 306 times

Last updated: Mar 13 '14