當使用Source Insight時,有可能會出現有些定義的macro或function找不到(顯示為黑),原因通常是source insight的數據庫文件被破壞了,這時可以用“Rebuild Project”這個選項去重新生成數據庫文件:選擇“project->Rebuild Project->Re-Create the whole project from scratch”。
Rebuild Project
The Rebuild Project command rebuilds the project database files.
You may want to rebuild the project to get all the files re-parsed after a large change, or if you suspect the project data is not correct.
A project may become corrupted if Source Insight was abnormally aborted without closing the project.
The Rebuild Project dialog box also lists some statistics about your project. The number of symbol database records, symbol index entries, and files is displayed. This information is also output by the Project Report command.
There are three methods of rebuilding the project. The last method is recommended.
Re-Parse all source files
This simply scans all the files in the project, and re-parses them to update the symbol database. This is the slowest method. However, if you cancel the operation, the symbol database will be left intact, although it may be slightly out of date. If you cancel, you can continue to edit normally and the re-parsing will continue in the background. The symbol database will be at least as current as it was when you began the rebuild process.
Fix database file corruption, if any
This option scans the databases and ensures that the databases are in a legal, self-consistent state. However, some files or symbols may be missing from the databases after the rebuild is complete if you recently added or removed files from your project. This is the fast method. You should use this command if you suspect that your project is corrupted. Normally, Source Insight can detect if a project was not closed properly when it tries to open the project. If Source Insight detects that the project is corrupt, it will ask you if you want to rebuild the project. Source Insight will not knowingly allow you to open a corrupted project.
Re-Create the whole project from scratch (recommended)
This is the most thorough method of rebuilding the project, and it is the recommended method. This deletes all symbolic information about the project, and rescans all the source files to regenerate the symbol database from scratch. It may take more time than the Fix database file corruption method. If you cancel it, the symbol database will be only partly complete. Source Insight will only have knowledge of symbols in the files that have been scanned. The background synchronization will complete the parsing. Alternatively, you can complete the process by using the Project > Synchronize Files command.
重建項目
重建項目命令重建項目數據庫文件。
您可能希望重新構建項目,以便在進行較大更改后重新解析所有文件,或者如果您懷疑項目數據不正確的話。
如果在不關閉項目的情況下異常中止了源代碼洞察,則項目可能會損壞。
“重建項目”對話框還列出了有關項目的一些統計信息。將顯示符號數據庫記錄、符號索引項和文件的數量。此信息也由Project Report命令輸出。
重建工程有三種方法。建議使用最后一種方法。
重新解析所有源文件
這只是掃描項目中的所有文件,並重新解析它們來更新符號數據庫。這是最慢的方法。但是,如果取消該操作,符號數據庫將保持不變,盡管它可能稍微有些過時。如果取消,則可以繼續正常編輯,重新解析將在后台繼續。符號數據庫至少與您開始重新構建過程時一樣最新。
修復數據庫文件損壞(如果有的話)
此選項掃描數據庫並確保數據庫處於合法的、自洽的狀態。但是,如果最近從項目中添加或刪除了文件,則在重新構建完成后,數據庫中可能會丟失一些文件或符號。這是最快的方法。如果您懷疑您的項目已損壞,應該使用此命令。通常,Source Insight可以在試圖打開項目時檢測項目是否沒有正確關閉。如果Source Insight檢測到項目已損壞,它將詢問您是否要重新構建項目。Source Insight不會故意允許您打開已損壞的項目。
從頭創建整個項目(推薦)
這是重建項目最徹底的方法,也是推薦的方法。這將刪除關於項目的所有符號信息,並重新掃描所有源文件以從頭生成符號數據庫。它可能比Fix數據庫文件損壞方法花費更多的時間。如果您取消它,符號數據庫將只完成部分。Source Insight只知道已掃描文件中的符號。后台同步將完成解析。或者,您可以使用Project > Synchronize Files命令完成該過程。