GithubHelp home page GithubHelp logo

用clang补全时出错 about emacs.d HOT 13 CLOSED

redguardtoo avatar redguardtoo commented on May 22, 2024
用clang补全时出错

from emacs.d.

Comments (13)

redguardtoo avatar redguardtoo commented on May 22, 2024

Version of plugins

from emacs.d.

 avatar commented on May 22, 2024

auto-complete-clang的版本时20120612,我下了个20120730版本的,把auto-complete-clang.el替换了,但是不行,我是个emacs新手,求指点呀

from emacs.d.

hongxuchen avatar hongxuchen commented on May 22, 2024

@baby-bear 看看*clang error* buffer的头几行报什么错吧:-)

from emacs.d.

 avatar commented on May 22, 2024

我感觉是clang-cc1的问题,首先好像没空格,而且编译c++一般好像用clang++,之后我把auto-complete-clang.el中一行 (append '("-cc1" " -fsyntax-only") 改成了 (append '("++ -cc1" " -fsyntax-only") 之后byte-compile-d,可还是不行.出现的错误都一样,而且minibuffer在开始只有一个build目录找不到的小错

from emacs.d.

hongxuchen avatar hongxuchen commented on May 22, 2024

@baby-bear clang的介绍页面是这样说的

Note, the -cc1 argument indicates the compiler front-end, and not the driver, should be run.

@brianjcj 原来的elisp上出错信息写得很不好,你如果信得过的话试试我这个吧https://github.com/HongxuChen/dotfiles/blob/master/_emacs.d/site-lisp/auto-complete-clang/auto-complete-clang.el ,出错的话就看echo area或者/tmp/ac-clang-stderr文件

不过我觉得auto-complete-clang响应时间上不行,所以基本上放弃了

from emacs.d.

redguardtoo avatar redguardtoo commented on May 22, 2024

use company-clang instead. I don't use auto-complete any more.

from emacs.d.

redguardtoo avatar redguardtoo commented on May 22, 2024

I will see to the auto-complete issue this weekend. besides, you know to make auto-complete-clang work in real project, you need manual set up, right?

I created another project cpputils-cmake to do that set up.

if you don't use cmake and cpputils-cmake, you need set upac-clang-flags by yourself.

In one of my project, the value of ac-clang-flags is:
("-I/home/cb/wxWidgets-master/build-release/lib/wx/include/gtk2-unicode-static-2.9" "-I/home/cb/wxWidgets-master/include" "-I/home/cb/projs/dumbway/src/desktop/lua-5.2.1/src" "-I/usr/include/gtk-2.0" "-I/usr/lib64/gtk-2.0/include" "-I/usr/include/atk-1.0" "-I/usr/include/cairo" "-I/usr/include/gdk-pixbuf-2.0" "-I/usr/include/pango-1.0" "-I/usr/include/glib-2.0" "-I/usr/lib64/glib-2.0/include" "-I/usr/include/pixman-1" "-I/usr/include/freetype2" "-I/usr/include/libpng15")

from emacs.d.

hongxuchen avatar hongxuchen commented on May 22, 2024

@redguardtoo auto-complete-clang sucks a lot since it uses vanilla clang --code-completion-at and cannot work well for larger projects(the flags issue is a permant headache, neither directory variables nor file local variables work well); there is also a problem with it: you cannot complete the function arguments when you are in template snippets stats. I remembered that the author referenced a lot of code from company-clang beforehand, which might be superior. But I think irony-mode and rtags are more suitable for C++ development. I hope you can have a try and share some customizations:-)

from emacs.d.

redguardtoo avatar redguardtoo commented on May 22, 2024

cool, definitely I will try irony-mode

from emacs.d.

notzhan avatar notzhan commented on May 22, 2024

恩,在编辑 .C 文件的时候,当想输入 struct test_stru 来定义一个结构体的时候, 输入到 struct tes 这个位置之后,就会出现这样的错误 /usr/bin/clang-cc1 -fsyntax-only -code-completion-macros -x c -code-completion-at -:2:12 - , clang error buffer 中的内容如下

clang failed with error 1:
/usr/bin/clang-cc1 -fsyntax-only -code-completion-macros -x c -code-completion-at -:5:12 -

<stdin>:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^
1 error generated.

如果已经定义了这个结构体,就不会出现这样的错误。

from emacs.d.

redguardtoo avatar redguardtoo commented on May 22, 2024

C-h v, check ac-clang-flags.

from emacs.d.

notzhan avatar notzhan commented on May 22, 2024

应该是在 init.el 中使用了 company-mode 而不是 auto-complete 的原因。

from emacs.d.

redguardtoo avatar redguardtoo commented on May 22, 2024

what's your auto-complete plugin?

On Thu, Aug 1, 2013 at 4:26 PM, Imtxc [email protected] wrote:

I don't have variable name called ac-clang-flags in Debian sid amd64
Emacs24.3 and Clang 3.2-10


Reply to this email directly or view it on GitHubhttps://github.com//issues/34#issuecomment-21917228
.

help me, help you.

from emacs.d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.