简体   繁体   中英

How and why is uncompiled C/C++ sometimes used?

I've seen some programs such as ROS use uncompiled C/C++ files (raw code, not yet compiled). In this example, C++ is used but not compiled. Most C/C++ I've learned so far needs to be compiled to run.

My guess here is that either they're compiled by the system every time it runs, or it's interpreted like Python.

How and why exactly are such uncompiled C/C++ files used?

The premise of your question is untrue.

The source code will undergo a translation process just as it always is.

The CMakeLists.txt file tells CMake what to do, with help from some items set up when you followed the build instructions. In examples given on the reference page you linked to, we have the common declaration to build a C++ file into an executable:

add_executable(talker src/talker.cpp)

…along with all the ROS-related business that gets performed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM