Clion adds files and compiles with an error “no such file or directory”
1.1 adding files
Create folders directly under the project directory and create source files and header files
After addition, errors will occur when writing. C files including. H files, which need to be modified cmakelist. TXT
Add header file
include_directories(Path1/path1 Path2/path2)
path1/path1
indicates the header file path. Different paths are separated by spaces, as shown in the following figure:
Add source file
file(GLOB_RECURSE SOURCES "directory/*.*")
directory
indicates the path folder name. The source files under different paths are separated by spaces, as shown in the following figure:
After completion, the compilation can reach 100%, but an error is reported: no such file or directory
By reference: clion 2020.2.4 cmake error reporting
When a newly added file is found, cmakelist. TXT
will automatically add linker_ SCRIPT
Delete the header file and source file behind it
set(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/STM32F103RFTx_FLASH.ld)
Compile again, no error will be reported and can be downloaded normally.
Read More:
- [tools] vscode debug report G + +. Exe no such file or directory fatal error no input files
- Clion compiles and runs a single C / cpp file
- Error: ENOENT: no such file or directory, open ‘E:\Program Files\nodejs\tmp\upload_38b32f25bc984333c
- Vscode compiles multiple files, compiles files in subfolders
- Clion automatically adds add_ executable
- Cmake error solution encountered in STM32 development with clion
- Solve syntax error: unexpected end of file or /bin/bash^m: bad interpeneter: no match file or directory
- When python installs pocketsphinx module (package), an error is reported: command ‘swig.exe’ failed: No such file or directory
- Cannot open include file: ‘io.h‘: No such file or directory
- No code, a solution to the error in the path of reading CSV file by Python: filenotfounderror: [errno 2] no such file or directory: ‘XX. CSV‘
- Solution of header file StdAfx. H “no such file or directory” in Visual Studio
- In VS2010, the compiler cannot open the file “GL / glaux. H”: no such file or directory
- Python FileNotFoundError: [Errno 2] No such file or directory: ‘objects/epsilon.pkl
- VS2010 compiler can’t open include file: “GL / glaux. H”: no such file or directory
- When installing pyaudio, an error is reported: failed error: portaudio. H: there is no such file or directory
- #During OpenGL development, fatal error C1083: can’t open include file: “GL / glut. H”: no such file or directory
- No such file or directory
- Xcode – pbxcp Error Repair – no such file or directory
- 【linux】error: stdio.h: No such file or directory
- When Python Django creates a database, can’t open file ‘ manage.py ‘: [Errno 2] No such file or directory