AtomLinter/linter-gcc

"No Such File or Directory" error for locally included file in C.

Opened this issue · 6 comments

Checklist

  • Check that you have the GNU C Compiler installed by typing gcc --version into a terminal.
  • If you don't have the linter package installed, either update to the latest version of linter-gcc or install linter directly with apm install linter.
  • Ensure that you are using a valid grammar - either C/C++/C++14
  • Ensure that you have read all the relevant information in the wiki, particularly the Common Issues page.

Issue (including debugging messages):

linter-gcc fails to lint any files because most of the files in my project contain an include directive using "" rather than <> to specify a local include file relative to the source file itself.

The linter seems to work fine for files included with <>, including my own include files, which I've included with ./include in the settings. But the local header I'm trying to include isn't in ./include, it's relative to the source files because it is a private, implementation-specific header to my project that I don't wish to expose to the outside API.

The header file itself is written in the nature "Private/Filename.h", with said Private folder being under src, rather than include.

I can confirm that using nothing but gcc on the command line, and substituting my options from the preferences onto the command line, I can compile the file with no complaints from gcc.

DEBUGGING LOG

config.js:43 linter-gcc: Using configuration page settings
utility.js:130 linter-gcc config: {"execPath":"/usr/bin/gcc","gccIncludePaths":" ./include","gccSuppressWarnings":false,"gccDefaultCFlags":"-c -O0 --std=c99 -Wall -pedantic -Wextra -Wformat -Wcast-align -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Winline -Wundef -Wnested-externs -Wcast-qual -Wshadow -Wwrite-strings -Wunused-parameter -Wfloat-equal","gccDefaultCppFlags":"-c -Wall -std=c++11","gccErrorLimit":0,"gccErrorString":"error","gccWarningString":"warning","gccNoteString":"note","compileCommandsFile":"./build/compile_commands.json"}
utility.js:142 /home/aargonian/Dropbox/TGA_READER/build/compile_commands.json
utility.js:208 linter-gcc: /usr/bin/gcc -c -O0 --std=c99 -Wall -pedantic -Wextra -Wformat -Wcast-align -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Winline -Wundef -Wnested-externs -Wcast-qual -Wshadow -Wwrite-strings -Wunused-parameter -Wfloat-equal -fmax-errors=0 -I/home/aargonian/Dropbox/TGA_READER/include /tmp/f603be1a-d5d6-431b-9572-74540edb7c3d.c

Exact same problem here, any workaround?

I think I had a similar problem. This is what I did to solve it:

  • Go to the linter-gcc package settings
  • Add the following to the GCC include paths -/*, ./*

The text in the settings page explains what this does

image

I will try, thanks!

This worked perfectly for me, thank you!

This worked for me.

These should be included by default by linter-gcc, I believe?

Hello Everyone,

I downloaded the MinGW but it still saying '' semaphore.h no such file or directory '' but when i click in open declaration the file appears in inc files. I did not understand when is the problem exactly ?
Can anyone help me please ??
Thank you in advance