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

Is ROS uses gcc or g++ compiler for c codes?

asked 2021-03-27 08:06:42 -0600

updated 2021-03-27 08:08:17 -0600

Hello community,

I have a C code which is using some C++ functions and i want to know if the ROS catkin_make uses gcc or g++ compiler ? Or where can i change the default compilers and compiling flags.

Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-03-28 08:11:16 -0600

miura gravatar image

You can check which compiler is being used by looking at the message when you run catkin_make.

If you get the following message, you are probably using gcc and LLVM g++.

-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is Clang 4.0.0

ref: http://wiki.ros.org/ROS/Tutorials/Bui...

To change the compiler and options, add the following to the CMakeList.txt file

set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_CXX_FLAGS "-O2")
set(CMAKE_C_FLAGS "-O2")

ref: https://answers.ros.org/question/5639...

edit flag offensive delete link more

Comments

2

Note: nothing here is ROS-specific. This is all CMake.

If you want to learn more about selecting and configuring compilers which will be used by Catkin/Colcon: look up the relevant CMake documentation.

gvdhoorn gravatar image gvdhoorn  ( 2021-03-28 12:23:12 -0600 )edit

The problem I'm facing is that Cmake is giving an error which is the compiler can't find some of the boost libraries (boost_signals), but i am pretty sure that the boost library is well installed.

seif_seghiri gravatar image seif_seghiri  ( 2021-03-30 23:47:28 -0600 )edit
1

This may have already been discussed in https://answers.ros.org/question/3331.... If not, please create a new question. I think we are starting to stray from the title of this question.

miura gravatar image miura  ( 2021-03-31 07:04:34 -0600 )edit

please can you tell me where can i find the tf ros package C/C++ codes because I'm only finding the include codes not source codes

seif_seghiri gravatar image seif_seghiri  ( 2021-04-01 14:56:11 -0600 )edit
1

You should create a new question. When asking a question, it is recommended that you also provide information about your OS and how you installed the tf package.

miura gravatar image miura  ( 2021-04-02 07:51:52 -0600 )edit

Question Tools

Stats

Asked: 2021-03-27 08:06:42 -0600

Seen: 944 times

Last updated: Mar 28 '21