cscope resolves the file not found problem (file: /XXX/YYY.C does not exist)

Source: Internet
Author: User
Tags python script
Error condition:

have been using Cscope to read the source code, during the encounter found a function/variable definition, but jump not past the situation, the hint "File." /xxxx/yyyy.c "There are no such errors. Workaround:

This problem occurs because the relative path is used when we use CSCOPE-RBQ to generate the Cscope.out file. The solution is also simple, using an absolute path when generating. Cscope Official provides a solution: Use the Cscope.files file to generate the Cscope.out file.

The Cscope.files content is all the filenames that need to be indexed. Like this:

As for how to generate the file, the simplest way is to use the Find command to list all eligible files and redirect them to Cscope.files. For example, find/-name *.c >> cscope.files. Of course, you can also write a simple shell or Python script to generate (at the end of the source code for Python scripts, in the need to generate Cscope.files directory to execute).

With Cscope.files, we can run CSCOPE-BQK. The problem with this relative path is solved.

Simple Python script:

#!/bin/python

import os

save_file = open ("Cscope.files", ' W ')

for Root, dirs, list in Os.walk ("./"):
    For I in list:
        Cur_path = Os.path.abspath (root)
        File_path = Cur_path + '/' + I

        save_file.write (file_path+ ' \ n ') )

Save_file.close ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.