zoukankan      html  css  js  c++  java
  • Eclipse cdt解决github导入的项目无法打开声明的bug (cannot open declaration)

    概述:

    我利用eclipse 的git插件clone github上的远程项目(C++)到本地时遇到一个问题:clone下来的项目没有C++特性,无法使用open declaration等操作,下面是解决这个问题的办法。

    问题:

    在eclipse cdt中import github的远程项目,操作是

    import ->Git/projects from git ->Clone URI

    导入的项目可以switch branch, 但就是不能打开函数的声明,实际上eclipse的一切快捷键都不能用了

    我看了下导入项目的preference,发现连c++ build选项都没有,觉得问题可能在于导入的项目没有语言(c++, c, java等等)信息,以至于被eclipse当成没有语言属性的general项目,快捷键这种依赖于编程语言的东西自然也就没办法用了

    解决办法:

    依然导入远程的github project到本地,在mac os下就是放在~/git/remoteproject下,linux应该一样的。然后import C/C++ -> Existing code as makefile project -> Browser ->选中remoteproject,也就是说我们手动创建C++项目,不再依靠egit自动生成

    新创建的项目需要自己取项目名字(直接从github导入的话名字不需要自己取得),除此之外一切特征都和我们期望的一致,可以switch to other branch, function declaration, call hierarchy都可以用了

    值得注意的是,有些项目导进来后可以直接用,有些就需要按照上述的流程走一遭,不知道为何

    参考: 

    中文没找到相关资料,英文的话找到了这个

    eclipse m2e: can't open declarations after importing maven projects

    问题的描述和我几乎一样,但是没人回答:(

    下面这个up主的问题和我也差不多,VonC同学回答给了我解决问题的启发(他的最后一句话)

    You could also use the "Import existing project" option, if your GitHub repo had versioned the .projectand .classpath file, but that may not be the case here.

    Importing a GitHub project into Eclipse

  • 相关阅读:
    MySQL数据库的常用命令
    MySQL数据库的概念
    Linux磁盘管理
    linux账号与权限管理
    安装及管理程序
    vi编辑器+常用命令
    centos7下部署elasticsearch7.2集群--Elastic Stack之一
    打开virt-manager界面显示方格乱码
    Rabbitmq之修改日志和数据存放路径
    Rabbitmq之Memory
  • 原文地址:https://www.cnblogs.com/xinsheng/p/4006502.html
Copyright © 2011-2022 走看看