Ale: Add all headers for clang and gcc linters

Created on 29 Mar 2018  路  5Comments  路  Source: dense-analysis/ale

Hi, so i'm a bit new with ale so i want to know what i should do to correctly include my headers with c and cpp using clang and gcc.
I know about issues #324 and #208 but i dont know how to use their information.
I want it to search recursively from the vim path but my usual working tree is:

  • ./
  • includes/
    > - subdirs/
  • srcs/
    > - subdirs/
    ...

Information

NVIM v0.2.2
Build type: Release

Mac Os X High Sierra 10.13.3 (17D102)

:ALEInfo

Current Filetype:
Available Linters: []
Enabled Linters: []
Linter Variables:

Global Variables:

let g:ale_cache_executable_check_failures = 0
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = 100
let g:ale_completion_enabled = 1
let g:ale_completion_max_suggestions = 50
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_lint_on_insert_leave = 0
let g:ale_linter_aliases = {}
let g:ale_linters = {'c': 'all'}
let g:ale_linters_explicit = 0
let g:ale_list_window_size = 10
let g:ale_list_vertical = 0
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = 0
let g:ale_open_list = 0
let g:ale_pattern_options = {}
let g:ale_pattern_options_enabled = 0
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 1
let g:ale_sign_error = '脭脛莽'
let g:ale_sign_info = '脭脛搂'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '脭脛莽'
let g:ale_sign_style_warning = '脭脛搂'
let g:ale_sign_warning = '脭脛搂'
let
clipboard: error: -2 g:ale_statusline_format = [' %d E ', ' %d W ', '']
let g:ale_type_map = {}
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1

and in my rc i use

let g:ale_c_clang_options = "-std=c++14 -Wall -I../** $(sdl2-config --libs) "
let g:ale_cpp_clang_options = "-std=c++14 -Wall -I../** $(sdl2-config --libs) "

What went wrong

I want clang to be able to avoid this error:
alt text

Most helpful comment

If you have a Makefile for your project, try setting g:ale_c_parse_makefile to 1. Some support has been added recently for parsing the output of make -n to figure out where headers are. It might not work perfectly yet. Beyond that, try setting b:ale_c_gcc_options or b:ale_c_clang_options (Or g: for global variable versions) to include all of the headers you need. See :help ale-c for all of the options for C linters.

All 5 comments

If you have a Makefile for your project, try setting g:ale_c_parse_makefile to 1. Some support has been added recently for parsing the output of make -n to figure out where headers are. It might not work perfectly yet. Beyond that, try setting b:ale_c_gcc_options or b:ale_c_clang_options (Or g: for global variable versions) to include all of the headers you need. See :help ale-c for all of the options for C linters.

Is there a way for me to tell my compiler via ale to look recursively for headers from the vim path or something else?

There's no way to tell your compiler to do that. Have you tried the make -n parsing option I recommended trying above?

It seems to work but including something like the SDL is not working out tho. I tried adding `sdl2-config --cflags` to g:ale_cpp_clang_options

The GitHub issue template now recommends asking for help with configuring ALE on Stack Exchange or Reddit instead.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chauncey-garrett picture chauncey-garrett  路  3Comments

janhellmich picture janhellmich  路  3Comments

aressler38 picture aressler38  路  3Comments

sublee picture sublee  路  3Comments

ianchanning picture ianchanning  路  3Comments