我正在寻找clang中相当于cl命令/FC的命令。我需要完整路径以便我的构建工具解析并打开代码文件以查看错误信息。
参考链接:https://msdn.microsoft.com/en-us/library/027c4t2s.aspx
参考链接:https://msdn.microsoft.com/en-us/library/027c4t2s.aspx
CFLAGS+= -fdiagnostics-absolute-paths
你需要在命令行中指定完全限定或相对路径,而不仅仅是传递文件名。在下面的示例中,调试器将不知道如何找到“blah.cc”,因为我只指定了文件名进行编译:
~ 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在何处查找代码。 您可以查看此处的文档here,不过两个可能有用的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 ...]
cl
是 Visual Studio 的东西。 - Brian Vandenberg