簡體   English   中英

lang錯誤中的完整代碼路徑

[英]Full code paths in clang errors

我在尋找cl命令/ FC的clang等效項。 我需要構建工具的完整路徑來解析並打開包含錯誤的代碼文件。

https://msdn.microsoft.com/en-us/library/027c4t2s.aspx

您需要在命令行上指定文件的標准路徑或相對路徑,而不是僅傳遞文件名。 在以下示例中,調試器將不知道在哪里可以找到“ 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在哪里查找代碼。 您可以在此處查看文檔,盡管有兩個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 ...]

CFLAGS + = -fdiagnostics-absolute-paths

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM