How to config YouCompleteMe for C language?
Recently, I installed YouCompleteMe
and I'm new user in it. I read installation instructions from this link: http://valloric.github.io/YouCompleteMe. Now, I can use it for python and etc, but I can't use it for C. I don't understand what's the meaning of this sentence from the link: "forget that if you want the C-family semantic completion engine to work, you will need to provide the compilation flags for your project to YCM."
I read the YCM user guide, but I couldn't solve my problem. Tnx from anybody who explains me what is the meaning of the above sentence and what do I do?
vim fedora autocomplete c
add a comment |
Recently, I installed YouCompleteMe
and I'm new user in it. I read installation instructions from this link: http://valloric.github.io/YouCompleteMe. Now, I can use it for python and etc, but I can't use it for C. I don't understand what's the meaning of this sentence from the link: "forget that if you want the C-family semantic completion engine to work, you will need to provide the compilation flags for your project to YCM."
I read the YCM user guide, but I couldn't solve my problem. Tnx from anybody who explains me what is the meaning of the above sentence and what do I do?
vim fedora autocomplete c
add a comment |
Recently, I installed YouCompleteMe
and I'm new user in it. I read installation instructions from this link: http://valloric.github.io/YouCompleteMe. Now, I can use it for python and etc, but I can't use it for C. I don't understand what's the meaning of this sentence from the link: "forget that if you want the C-family semantic completion engine to work, you will need to provide the compilation flags for your project to YCM."
I read the YCM user guide, but I couldn't solve my problem. Tnx from anybody who explains me what is the meaning of the above sentence and what do I do?
vim fedora autocomplete c
Recently, I installed YouCompleteMe
and I'm new user in it. I read installation instructions from this link: http://valloric.github.io/YouCompleteMe. Now, I can use it for python and etc, but I can't use it for C. I don't understand what's the meaning of this sentence from the link: "forget that if you want the C-family semantic completion engine to work, you will need to provide the compilation flags for your project to YCM."
I read the YCM user guide, but I couldn't solve my problem. Tnx from anybody who explains me what is the meaning of the above sentence and what do I do?
vim fedora autocomplete c
vim fedora autocomplete c
asked Aug 13 '16 at 9:52
ThisIsMe
1637
1637
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You need to have a file named .ycm_extra_conf.py in the directory containing the projects source code. That link is to the example file provided with the plugin, and you have to update it to properly describe your compilation options.
I usually create one (or more) for a project and commit them along with the project into whatever scm program I'm using.
Couple of things to watch out for:
If you are used to gcc there are some compilation flags that clang (what YCM is using) doesn't support.
If you are compiling linux kernel code (driver, etc) it will not work well, since clang doesn't support many of the assembly macros provided by gcc. I'm not aware of a workaround.
Additional info from developer:
C-family Semantic Completion
YCM looks for a .ycm_extra_conf.py file in the directory of the opened
file or in any directory above it in the hierarchy (recursively); when
the file is found, it is loaded (only once!) as a Python module. YCM
calls a FlagsForFile method in that module which should provide it
with the information necessary to compile the current file. You can
also provide a path to a global .ycm_extra_conf.py file, which will be
used as a fallback. To prevent the execution of malicious code from a
file you didn't write YCM will ask you once per .ycm_extra_conf.py if
it is safe to load. This can be disabled and you can white-/blacklist
files. See the Options section for more details.
See YCM's own .ycm_extra_conf.py for details on how this works. You
should be able to use it as a starting point. Don't just copy/paste
that file somewhere and expect things to magically work; your project
needs different flags. Hint: just replace the strings in the flags
variable with compilation flags necessary for your project. That
should be enough for 99% of projects.
If you've modified and added this file to your project (or provided a path to it) you will not get the same error message as in your original question. If you do, YCM can't see it - possibly named incorrectly ( leading . ) or not in the right level in the source hierarchy - see link above.
Otherwise if its still not working you should have a different error message; post that. Initial YCM configuration takes some work and took a few trips through their documentation the first time.
Tnx but it doesn't work for me.
– ThisIsMe
Aug 14 '16 at 20:34
add a comment |
I don't understand what's the meaning of this sentence from the link:
"forget that if you want the C-family semantic completion engine to
work, you will need to provide the compilation flags for your project
to YCM."
This simply means that instad of compiling like
cd ~/.vim/bundle/YouCompleteMe
./install.py
You need to add
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
I think the install instructions are updated anyway to reflect the above.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1113114%2fhow-to-config-youcompleteme-for-c-language%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to have a file named .ycm_extra_conf.py in the directory containing the projects source code. That link is to the example file provided with the plugin, and you have to update it to properly describe your compilation options.
I usually create one (or more) for a project and commit them along with the project into whatever scm program I'm using.
Couple of things to watch out for:
If you are used to gcc there are some compilation flags that clang (what YCM is using) doesn't support.
If you are compiling linux kernel code (driver, etc) it will not work well, since clang doesn't support many of the assembly macros provided by gcc. I'm not aware of a workaround.
Additional info from developer:
C-family Semantic Completion
YCM looks for a .ycm_extra_conf.py file in the directory of the opened
file or in any directory above it in the hierarchy (recursively); when
the file is found, it is loaded (only once!) as a Python module. YCM
calls a FlagsForFile method in that module which should provide it
with the information necessary to compile the current file. You can
also provide a path to a global .ycm_extra_conf.py file, which will be
used as a fallback. To prevent the execution of malicious code from a
file you didn't write YCM will ask you once per .ycm_extra_conf.py if
it is safe to load. This can be disabled and you can white-/blacklist
files. See the Options section for more details.
See YCM's own .ycm_extra_conf.py for details on how this works. You
should be able to use it as a starting point. Don't just copy/paste
that file somewhere and expect things to magically work; your project
needs different flags. Hint: just replace the strings in the flags
variable with compilation flags necessary for your project. That
should be enough for 99% of projects.
If you've modified and added this file to your project (or provided a path to it) you will not get the same error message as in your original question. If you do, YCM can't see it - possibly named incorrectly ( leading . ) or not in the right level in the source hierarchy - see link above.
Otherwise if its still not working you should have a different error message; post that. Initial YCM configuration takes some work and took a few trips through their documentation the first time.
Tnx but it doesn't work for me.
– ThisIsMe
Aug 14 '16 at 20:34
add a comment |
You need to have a file named .ycm_extra_conf.py in the directory containing the projects source code. That link is to the example file provided with the plugin, and you have to update it to properly describe your compilation options.
I usually create one (or more) for a project and commit them along with the project into whatever scm program I'm using.
Couple of things to watch out for:
If you are used to gcc there are some compilation flags that clang (what YCM is using) doesn't support.
If you are compiling linux kernel code (driver, etc) it will not work well, since clang doesn't support many of the assembly macros provided by gcc. I'm not aware of a workaround.
Additional info from developer:
C-family Semantic Completion
YCM looks for a .ycm_extra_conf.py file in the directory of the opened
file or in any directory above it in the hierarchy (recursively); when
the file is found, it is loaded (only once!) as a Python module. YCM
calls a FlagsForFile method in that module which should provide it
with the information necessary to compile the current file. You can
also provide a path to a global .ycm_extra_conf.py file, which will be
used as a fallback. To prevent the execution of malicious code from a
file you didn't write YCM will ask you once per .ycm_extra_conf.py if
it is safe to load. This can be disabled and you can white-/blacklist
files. See the Options section for more details.
See YCM's own .ycm_extra_conf.py for details on how this works. You
should be able to use it as a starting point. Don't just copy/paste
that file somewhere and expect things to magically work; your project
needs different flags. Hint: just replace the strings in the flags
variable with compilation flags necessary for your project. That
should be enough for 99% of projects.
If you've modified and added this file to your project (or provided a path to it) you will not get the same error message as in your original question. If you do, YCM can't see it - possibly named incorrectly ( leading . ) or not in the right level in the source hierarchy - see link above.
Otherwise if its still not working you should have a different error message; post that. Initial YCM configuration takes some work and took a few trips through their documentation the first time.
Tnx but it doesn't work for me.
– ThisIsMe
Aug 14 '16 at 20:34
add a comment |
You need to have a file named .ycm_extra_conf.py in the directory containing the projects source code. That link is to the example file provided with the plugin, and you have to update it to properly describe your compilation options.
I usually create one (or more) for a project and commit them along with the project into whatever scm program I'm using.
Couple of things to watch out for:
If you are used to gcc there are some compilation flags that clang (what YCM is using) doesn't support.
If you are compiling linux kernel code (driver, etc) it will not work well, since clang doesn't support many of the assembly macros provided by gcc. I'm not aware of a workaround.
Additional info from developer:
C-family Semantic Completion
YCM looks for a .ycm_extra_conf.py file in the directory of the opened
file or in any directory above it in the hierarchy (recursively); when
the file is found, it is loaded (only once!) as a Python module. YCM
calls a FlagsForFile method in that module which should provide it
with the information necessary to compile the current file. You can
also provide a path to a global .ycm_extra_conf.py file, which will be
used as a fallback. To prevent the execution of malicious code from a
file you didn't write YCM will ask you once per .ycm_extra_conf.py if
it is safe to load. This can be disabled and you can white-/blacklist
files. See the Options section for more details.
See YCM's own .ycm_extra_conf.py for details on how this works. You
should be able to use it as a starting point. Don't just copy/paste
that file somewhere and expect things to magically work; your project
needs different flags. Hint: just replace the strings in the flags
variable with compilation flags necessary for your project. That
should be enough for 99% of projects.
If you've modified and added this file to your project (or provided a path to it) you will not get the same error message as in your original question. If you do, YCM can't see it - possibly named incorrectly ( leading . ) or not in the right level in the source hierarchy - see link above.
Otherwise if its still not working you should have a different error message; post that. Initial YCM configuration takes some work and took a few trips through their documentation the first time.
You need to have a file named .ycm_extra_conf.py in the directory containing the projects source code. That link is to the example file provided with the plugin, and you have to update it to properly describe your compilation options.
I usually create one (or more) for a project and commit them along with the project into whatever scm program I'm using.
Couple of things to watch out for:
If you are used to gcc there are some compilation flags that clang (what YCM is using) doesn't support.
If you are compiling linux kernel code (driver, etc) it will not work well, since clang doesn't support many of the assembly macros provided by gcc. I'm not aware of a workaround.
Additional info from developer:
C-family Semantic Completion
YCM looks for a .ycm_extra_conf.py file in the directory of the opened
file or in any directory above it in the hierarchy (recursively); when
the file is found, it is loaded (only once!) as a Python module. YCM
calls a FlagsForFile method in that module which should provide it
with the information necessary to compile the current file. You can
also provide a path to a global .ycm_extra_conf.py file, which will be
used as a fallback. To prevent the execution of malicious code from a
file you didn't write YCM will ask you once per .ycm_extra_conf.py if
it is safe to load. This can be disabled and you can white-/blacklist
files. See the Options section for more details.
See YCM's own .ycm_extra_conf.py for details on how this works. You
should be able to use it as a starting point. Don't just copy/paste
that file somewhere and expect things to magically work; your project
needs different flags. Hint: just replace the strings in the flags
variable with compilation flags necessary for your project. That
should be enough for 99% of projects.
If you've modified and added this file to your project (or provided a path to it) you will not get the same error message as in your original question. If you do, YCM can't see it - possibly named incorrectly ( leading . ) or not in the right level in the source hierarchy - see link above.
Otherwise if its still not working you should have a different error message; post that. Initial YCM configuration takes some work and took a few trips through their documentation the first time.
edited Aug 15 '16 at 19:55
answered Aug 14 '16 at 5:08
Argonauts
3,7951122
3,7951122
Tnx but it doesn't work for me.
– ThisIsMe
Aug 14 '16 at 20:34
add a comment |
Tnx but it doesn't work for me.
– ThisIsMe
Aug 14 '16 at 20:34
Tnx but it doesn't work for me.
– ThisIsMe
Aug 14 '16 at 20:34
Tnx but it doesn't work for me.
– ThisIsMe
Aug 14 '16 at 20:34
add a comment |
I don't understand what's the meaning of this sentence from the link:
"forget that if you want the C-family semantic completion engine to
work, you will need to provide the compilation flags for your project
to YCM."
This simply means that instad of compiling like
cd ~/.vim/bundle/YouCompleteMe
./install.py
You need to add
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
I think the install instructions are updated anyway to reflect the above.
add a comment |
I don't understand what's the meaning of this sentence from the link:
"forget that if you want the C-family semantic completion engine to
work, you will need to provide the compilation flags for your project
to YCM."
This simply means that instad of compiling like
cd ~/.vim/bundle/YouCompleteMe
./install.py
You need to add
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
I think the install instructions are updated anyway to reflect the above.
add a comment |
I don't understand what's the meaning of this sentence from the link:
"forget that if you want the C-family semantic completion engine to
work, you will need to provide the compilation flags for your project
to YCM."
This simply means that instad of compiling like
cd ~/.vim/bundle/YouCompleteMe
./install.py
You need to add
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
I think the install instructions are updated anyway to reflect the above.
I don't understand what's the meaning of this sentence from the link:
"forget that if you want the C-family semantic completion engine to
work, you will need to provide the compilation flags for your project
to YCM."
This simply means that instad of compiling like
cd ~/.vim/bundle/YouCompleteMe
./install.py
You need to add
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
I think the install instructions are updated anyway to reflect the above.
answered Aug 26 '17 at 19:34
pragMATHiC
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1113114%2fhow-to-config-youcompleteme-for-c-language%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown