clang错误中的完整代码路径
Full code paths in clang errors
我正在寻找cl命令/FC的clang等效。我需要我的构建工具的完整路径来解析和打开带有错误的代码文件。
https://msdn.microsoft.com/en-us/library/027c4t2s.aspxCFLAGS+= -fdiagnostics-absolute-paths
您需要在命令行上为文件指定一个完全限定的或相对的路径,而不是只传递文件名。在下面的示例中,调试器将不知道在哪里找到"blah"。因为我编译时只指定了文件名:
~ pwd
/mnt/scratch/myproject/src
~ clang++ blah.cc -c -o /mnt/scratch/myproject/build/blah.o
~ cd ../build
~ clang++ *.o -o myprogram
…但是,如果我这样做:
~ pwd
/mnt/scratch/myproject
~ clang++ /mnt/scratch/myproject/src/blah.cc -c -o /mnt/scratch/myproject/build/blah.o
# or:
~ clang++ src/blah.cc -c -o build/blah.o
# ...
…然后,它将完全限定路径或相对路径嵌入到调试部分中。
如果使用部分限定的路径,则必须告诉GDB在哪里查找代码。您可以在这里查看相关文档,不过两个gdb命令可能会有所帮助:
# This will cause gdb to look in "path2" instead of "path1"
(gdb) set substitute-path path1 path2
# This allows you to give a list of directories to search for your source.
# note that if you give relative paths on the command-line, it'll concatenate
# these paths and the relative path used at compile-time.
(gdb) set directories path [path ...]
相关文章:
- C++:如何为多个重载函数保留通用代码路径?
- 我最近更改了编译器路径以运行 c++ 代码,但现在我无法运行任何 python 代码。我该如何解决这个问题?
- 定义在其中执行不同代码路径的代码节
- 如何设置 CMake 来构建包含路径包含的代码,如 #include < libdir/lib>?
- VS代码无法识别包含路径
- 通过程序代码行设置C++包含路径
- C 能够以其完整路径打开代码::块中的文件,但不能以相对路径作为命令行参数打开文件
- 在 cpp 中验证路径:无法使用 ASCII 代码删除特殊字符
- VS 代码C++:无法启动调试 - 程序路径丢失或无效
- 代码块,添加了环境变量路径,但在安装文件夹之外出现 g++ 错误
- 管理代码中的硬编码文件路径/名称
- gcc为不同路径的相同代码库生成的二进制文件中的差异
- 从C++代码运行JVM并设置类路径
- 本机代码中外部存储的应用路径
- 如何在C++中编写一段代码以查找系统路径上文件的完整路径
- 在静态库中硬编码的代码文件和头路径
- 代码块编译的exe链接到一个没有系统路径变量(C++)的dll
- 代码::BLOCKS-为什么路径不正确
- clang错误中的完整代码路径
- 如何从复杂算法中提取活动代码路径