You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Help: Using Code App on iOS for cross-file C++ programming (I'm a beginner in C++ and not doing particularly complex development) #1305
Help: Using Code App on iOS for cross-file C++ programming (I'm a beginner in C++ and not doing particularly complex development)
Does the Code App on the iOS App Store support cross-file programming? For example, a folder containing myhead.h (function declarations), myfunction.cpp (function definitions), and main.cpp (a main function that calls the functions declared in myhead.h and defined in myfunction.cpp). If there is a way to achieve cross-file programming, please help me out. I don’t know how to properly compile and run files across multiple sources.
I tried entering commands in the terminal (the command was clang++ main.cpp my.cpp -o myPro), but the terminal kept reporting errors.!
Does the Code App on the iOS App Store support cross-file programming? For example, a folder containing myhead.h (function declarations), myfunction.cpp (function definitions), and main.cpp (a main function that calls the functions declared in myhead.h and defined in myfunction.cpp). If there is a way to achieve cross-file programming, please help me out. I don’t know how to properly compile and run files across multiple sources.
I tried entering commands in the terminal (the command was clang++ main.cpp my.cpp -o myPro), but the terminal kept reporting errors.
You can use clang to compile the files manually; however, it is a must-have feature for C++ programmers to run a program with multiple .cpp files directly from the Code app. Hopefully, the developers will add this feature in a future version.
mkdir -p build/obj
clang++ <CLANG-OPTIONS> -c -o build/obj/<file1>.obj src/<file1>.cpp
# ... do this for every source file
clang++ <CLANG-OPTIONS> -o build/<bin><files paths forbinin build/obj>
The first clang calls only compile the sources into linkable object files (don't know if there is a difference using wasm) and the last call builds it into one "executable" (wasm) file
but since running sh script (after trying) doesn't currently seem to be supported you can just put this in a python script, which executes each command (this can also simplify the process of adding new files to the build)
Activity
suiyutong61 commentedon Jan 19, 2026
Does the Code App on the iOS App Store support cross-file programming? For example, a folder containing myhead.h (function declarations), myfunction.cpp (function definitions), and main.cpp (a main function that calls the functions declared in myhead.h and defined in myfunction.cpp). If there is a way to achieve cross-file programming, please help me out. I don’t know how to properly compile and run files across multiple sources.
I tried entering commands in the terminal (the command was clang++ main.cpp my.cpp -o myPro), but the terminal kept reporting errors.
Jakubpoland commentedon Feb 14, 2026
What I found that could help
holzschu/a-shell#225 (comment)
carinconc commentedon Feb 18, 2026
You can use clang to compile the files manually; however, it is a must-have feature for C++ programmers to run a program with multiple .cpp files directly from the Code app. Hopefully, the developers will add this feature in a future version.
Knoficooki commentedon Feb 21, 2026
You can write a simple build script like this:
The first clang calls only compile the sources into linkable object files (don't know if there is a difference using wasm) and the last call builds it into one "executable" (wasm) file
Example:
could be compiled using:
use
clanginstead ofclang++for Cbut since running
shscript (after trying) doesn't currently seem to be supported you can just put this in a python script, which executes each command (this can also simplify the process of adding new files to the build)