Giter VIP home page Giter VIP logo

linter-gcc's Introduction

linter-gcc

Join the chat at https://gitter.im/linter-gcc/Lobby Build Status apm

This plugin provides an interface to gcc/g++ for linting and works with Linter.

Used with files with grammar "C", "C++" and "C++14".

Includes linting on-the-fly, though it is only partially tested. Please open an issue if you encounter any problems.

Important info for Mac OSX users!

If you have XCode installed on OSX, the gcc/g++ commands will both link to clang. This can cause issues with the -fmax-errors option used by linter-gcc, which isn't recognised by clang. To properly install GCC, you need to install it with Homebrew (instructions here). You will likely also need to add the flag -fsyntax-only to your C Flags or C++ Flags.

Linter in action!

linter-gcc screenshot

Using CMake compile settings

linter-gcc can take compile settings from CMake. For example:

git clone https://github.com/hebaishi/gtf2tab
cd gtf2tab
mkdir build
cd build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..

Running cmake with the -DCMAKE_EXPORT_COMPILE_COMMANDS flag generates a compile_commands.json file which linter-gcc can get the compile settings from. Then you simply open the project in Atom, and enter ./build/compile_commands.json in the Compile Commands File setting of linter-gcc. Note that if you supply a valid compile_commands.json file, your include paths and compile flags configuration settings (described below) are ignored.

Unfortunately, CMake does not typically compile header files so the compile_commands.json file does not include entries for these files. To add them you can use a tool like compdb.

compdb -p ./ list > compile_commands.json

File/Project-Specific settings

Assuming you have the a file called sample.cpp open, linter-gcc performs the following actions:

  1. Looks for file called sample.cpp.gcc-flags.json in the same directory as your source file (file-specific settings)
  2. Looks for a file called .gcc-flags.json in every subdirectory from the current up to your project root (subdirectory/project-specific settings)
  3. If no .gcc-flags.json is found, the settings in your configuration page are used.

The package takes its settings from the first configuration file that is found.

You can specify your settings in .gcc-flags.json, at any level (file/subdirectory/project) using the following syntax:

{
  "execPath": "/usr/bin/g++",
  "gccDefaultCFlags": "-Wall",
  "gccDefaultCppFlags": "-Wall -std=c++11",
  "gccErrorLimit": 15,
  "gccIncludePaths": ".,./include,./path",
  "gccSuppressWarnings": true
}

Note that the include paths need to be separated by commas. If this file is present, it will replace the settings you specified in the settings window. Relative paths (starting with . or ..) are expanded with respect to the root folder. Both execPath and gccIncludePaths are expanded.

Paths are expanded relative to the project that contains the file being linted. The package limits its search to 30 levels when looking for a configuration file. Within each project, you may have as many file/directory-specific configuration files as you wish.

Usage notes:

  • Add -fsyntax-only to your C/C++ compilation flags to prevent the generation of .gch files when linting headers
  • Add -c to your flags to avoid linking errors.

Plugin installation

Press ctrl and ',' or cmd and ',' , click on 'Packages', search 'linter gcc', or:

$ apm install linter-gcc

Reporting Issues

Please read the Wiki before reporting any issues.

linter-gcc's People

Contributors

cicchr avatar engelmarkus avatar gitter-badger avatar guysherman avatar hebaishi avatar keplersj avatar lukeshingles avatar marcangels avatar matlegat avatar mkstayalive avatar nekromant avatar nyorain avatar suda avatar tvincent056 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linter-gcc's Issues

Relative execPath not working

Latest release (37dadcf) broke my relative build path I'm afraid.

.gcc-flags.json

{
  "execPath": "./Sw/P_XMC/tools/ARM-GCC/bin/arm-none-eabi-gcc",
  "gccDefaultCFlags": "-Wall",
  "gccDefaultCppFlags": "-Wall -std=c++11",
  "gccErrorLimit": 5,
  "gccIncludePaths": "Sw/A_XMC/out/obj",
  "gccSuppressWarnings": true
}

linter-gcc: "./Sw/P_XMC/tools/ARM-GCC/bin/arm-none-eabi-gcc" not found

Win7, Atom 1.3.2, linter-gcc 0.5.11

Uncaught TypeError: Cannot read property 'binary' of undefined

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.5.3
System: ALI-PC
Thrown From: linter-gcc package, v0.6.5

Stack Trace

Uncaught TypeError: Cannot read property 'binary' of undefined

At C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\src\pane.js:825

TypeError: Cannot read property 'binary' of undefined
    at Object.lint (C:/Users/Ali/.atom/packages/linter-gcc/lib/main.js:61:32)
    at lintOnSave (C:/Users/Ali/.atom/packages/linter-gcc/lib/main.js:107:22)
    at Function.module.exports.Emitter.simpleDispatch (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\node_modules\event-kit\lib\emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\node_modules\event-kit\lib\emitter.js:125:28)
    at TextBuffer.module.exports.TextBuffer.saveAs (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\node_modules\text-buffer\lib\text-buffer.js:1067:27)
    at TextBuffer.module.exports.TextBuffer.save (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\node_modules\text-buffer\lib\text-buffer.js:1037:19)
    at TextEditor.module.exports.TextEditor.save (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\src\text-editor.js:630:26)
    at Pane.module.exports.Pane.saveItem (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\src\pane.js:545:18)
    at Pane.module.exports.Pane.saveActiveItem (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\src\pane.js:528:19)
    at Workspace.module.exports.Workspace.saveActivePaneItem (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\src\workspace.js:649:35)
    at atom-workspace.commandRegistry.add.core:save (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\src\register-default-commands.js:173:32)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\src\command-registry.js:260:29)
    at C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\src\command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:536:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:359:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeydown (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\src\window-event-handler.js:97:36)
    at HTMLDocument.<anonymous> (C:\Users\Ali\AppData\Local\atom\app-1.5.3\resources\app.asar\src\window-event-handler.js:3:61)

Commands

     -9:54.9.0 core:save (div.package-detail.panels-item)
     -9:34.5.0 editor:newline (atom-text-editor.editor.is-focused)
     -9:31.1.0 core:save (atom-text-editor.editor.is-focused)
     -8:58.7.0 core:backspace (atom-text-editor.editor.is-focused)
  2x -8:57.7.0 core:save (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "minimap"
    ],
    "themes": [
      "atom-dark-ui",
      "one-dark-syntax"
    ]
  },
  "linter-gcc": {
    "execPath": "MinGW/bin/gcc"
  }
}

Installed Packages

# User
atom-html-preview, v0.1.13
autoclose-html, v0.20.0
autocomplete-html-entities, v0.1.0
autocomplete-python, v1.6.1
color-picker, v2.1.1
linter, v1.11.3
linter-gcc, v0.6.5
terminal-plus, v0.14.5

# Dev
No dev packages

Can someone help me I installed Atom new and i dont know what i did wrong.

Uncaught Error: ENOENT: no such file or directory, scandir '/home/local/DOMAIN2003/test50/git/inc...

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.8.0-beta3
System: Ubuntu 12.04.4
Thrown From: linter-gcc package, v0.6.14

Stack Trace

Uncaught Error: ENOENT: no such file or directory, scandir '/home/local/DOMAIN2003/test50/git/include -I/usr/include/libxml2'

At /usr/local/share/atom-beta/resources/app.asar/src/pane.js:1002

Error: ENOENT: no such file or directory, scandir '/home/local/DOMAIN2003/test50/git/include -I/usr/include/libxml2'
    at Error (native)
    at Object.fs.readdirSync (fs.js:856:18)
    at Object.fs.readdirSync (ATOM_SHELL_ASAR.js:497:28)
    at Object.module.exports.walkSync (/home/local/DOMAIN2003/test50/.atom/packages/linter-gcc/lib/utility.js:15:16)
    at /home/local/DOMAIN2003/test50/.atom/packages/linter-gcc/lib/utility.js:75:37
    at Array.forEach (native)
    at Object.module.exports.splitStringTrim (/home/local/DOMAIN2003/test50/.atom/packages/linter-gcc/lib/utility.js:66:14)
    at Object.module.exports.buildCommand (/home/local/DOMAIN2003/test50/.atom/packages/linter-gcc/lib/utility.js:136:40)
    at Object.lint (/home/local/DOMAIN2003/test50/.atom/packages/linter-gcc/lib/main.js:93:36)
    at lintOnSave (/home/local/DOMAIN2003/test50/.atom/packages/linter-gcc/lib/main.js:154:22)
    at Function.module.exports.Emitter.simpleDispatch (/usr/local/share/atom-beta/resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/usr/local/share/atom-beta/resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at TextBuffer.module.exports.TextBuffer.saveAs (/usr/local/share/atom-beta/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1113:27)
    at TextBuffer.module.exports.TextBuffer.save (/usr/local/share/atom-beta/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1083:19)
    at TextEditor.module.exports.TextEditor.save (/usr/local/share/atom-beta/resources/app.asar/src/text-editor.js:660:26)
    at Pane.module.exports.Pane.saveItem (/usr/local/share/atom-beta/resources/app.asar/src/pane.js:718:18)
    at Pane.module.exports.Pane.saveActiveItem (/usr/local/share/atom-beta/resources/app.asar/src/pane.js:701:19)
    at Workspace.module.exports.Workspace.saveActivePaneItem (/usr/local/share/atom-beta/resources/app.asar/src/workspace.js:684:35)
    at atom-workspace.commandRegistry.add.core:save (/usr/local/share/atom-beta/resources/app.asar/src/register-default-commands.js:214:32)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/local/share/atom-beta/resources/app.asar/src/command-registry.js:260:29)
    at /usr/local/share/atom-beta/resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/local/share/atom-beta/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/local/share/atom-beta/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/usr/local/share/atom-beta/resources/app.asar/src/window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (/usr/local/share/atom-beta/resources/app.asar/src/window-event-handler.js:3:61)

Commands

     -0:00.9.0 core:save (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "vim-mode",
      "activate-power-mode"
    ],
    "themes": [
      "atom-material-ui",
      "atom-material-syntax"
    ]
  },
  "linter-gcc": {
    "gccIncludePaths": ".,../,./include,../include -I/usr/include/libxml2/*"
  }
}

Installed Packages

# User
atom-beautify, v0.29.7
atom-material-syntax, v0.4.6
atom-material-ui, v1.2.11
autocomplete-paths, v1.0.2
docblockr, v0.7.3
emmet, v2.4.3
esformatter, v1.25.0
file-icons, v1.7.11
highlight-selected, v0.11.2
linter, v1.11.4
linter-gcc, v0.6.14
merge-conflicts, v1.4.2
minimap, v4.23.5
minimap-bookmarks, v0.3.1
minimap-find-and-replace, v4.5.1
minimap-highlight-selected, v4.4.0
minimap-selection, v4.4.0
pigments, v0.26.2
simplified-chinese-menu, v3.4.11
sync-settings, v0.7.2
terminal-plus, v0.14.5

# Dev
No dev packages

uintXX_t does not name a type in header files

Hello... I'm not sure if it is really an issue, however I couldn't find the answer in any other place.

I'm trying to use atom for coding my C projects (moving from eclipse). I've recently installed atom and platformio-ide packages (which includes linter-gcc, clang-autocomplete,etc) and it is all perfectly working (including my .gcc-flags.json file). However, an issue raised up:

Usually I don't put any header file (#include statements) in my header files. When am I dealing with some type from stdint.h (uint8_t for example), I just make sure that in my source file, the stdint.h file is being included before my header file. So, in atom, when I put some uintxx_t in my header file, the linter-gcc accuses an error: 'uint8_t' does not name a type.

So, having said that, can I remove these errors WITHOUT including the stdint.h in my header file? I'm sorry if it is a newbie question, but I've googled it for some time and I couldn't find any related issue.

Feature request - recursive include paths

In the .gcc-flags.json file, "gccIncludePaths" can get to be really long. When many libraries are stored under a single folder, e.g. the Arduino "libraries" folder, it would be useful to be able to specify the root folder and tell linter-gcc to recursively search all of the folders under that folder, instead of adding every sub-folder individually.

Not using the compiler options for C++ when using C++14 syntax

So, after embarassing myself over here AtomLinter/linter-cpplint#38, I hope i'm doing the right thing this time, i'll copy and paste from that.

I have a package called language-cpp14 installed. I just installed because it sounds cool and seems to add some extra neat things, but I don't really know if I need it. I'm new to C++, so sorry if I'm not making any sense.

I have a perfectly valid C++ program using C++11 stuff. But since i've installed the language-cpp14 extension, the current language i'm using in Atom is also called C++14.

I know exactly where the problem lies: main.js, line 100:

if(grammar_name === "C++") {
    flags = settings.gccDefaultCppFlags;
} else if(grammar_name === "C") {
   flags = settings.gccDefaultCFlags;
}

I figured that grammar_name is C++14 so it doesn't use the flags. And throws over 5000 errors when I save the file, because it seems that G++ will default to the old c++.

I'm OK with using the normal C++ though, and that's what I'll do, probably. I was just wondering if that's a problem. Would that be correct to check whether grammar_name contains the string c++14?

.c source changed to .cpp - gcc interprets file differently

Hi,
this package seems to be copying my .c source file to /tmp/ with an extension of .cpp.
My older gcc-4.6 is interpreting this file differently depending on the extension.

Can the file extension of the source file be preserved?
thanks

linting on fly

A linting on fly (while typing instead after saving a file) is really missing.

Linter can't find <iostream>, but g++ can

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

Issue (including debugging messages):

Windows user here.

The linter is giving me an error on this very basic program that it can't find <iostream>.
My GCC Executable Path is C:\MinGW\bin\g++.exe.
Using that very same path to compile my program using the commandline (g++ main.cpp) works perfectly.

Any help is appreciated.

Seemingly incorrect errors, potentially related to C++11

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

Issue (including debugging messages):

When I compile my program with g++ myccfile.cc -std=c++11 -Wall, it works fine (all I get are a few warnings about unused functions). The clang linter shows the same warnings, but nothing else.

linter-gcc, however, shows me a ton of errors. In the .cc file I'm compiling, I'm getting a "No such file or directory" error on my first include (regardless of whether I add it to the include path). It's definitely the right file path because it compiles fine. The first error for the project as a whole is

"#error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.at line 32 col 2 in /usr/include/c++/4.8/bits/c++0x_warning.h".

despite the fact that I have -std=c++11 in my flags. There are also a number of warnings about the fact that I'm using C++11 reserved words (I'm using them for their intended purpose). I'm using the C++14 grammar (using the C++ grammar doesn't fix it).

Here are the debugging messages I get on the console when linter-gcc runs:

linter-gcc: Using configuration page settings
/home/emily/.atom/packages/linter-gcc/lib/utility.js:94 linter-gcc config: {"execPath":"/usr/bin/g++","gccIncludePaths":"./evo/, ./tools/","gccSuppressWarnings":false,"gccDefaultCFlags":"-std=c++11","gccDefaultCppFlags":"-c -std=c++11","gccErrorLimit":0,"gccErrorString":"error","gccWarningString":"warning","gccNoteString":"note"}
2/home/emily/.atom/packages/linter-gcc/lib/utility.js:76 Expanding directories
/home/emily/.atom/packages/linter-gcc/lib/utility.js:146 linter-gcc: /usr/bin/g++ -c -std=c++11 -fmax-errors=0 -I/home/emily/repos/Empirical/evo -I/home/emily/repos/Empirical/tools /tmp/5b9837c7-122b-4820-8092-d54549d3bf68.cpp

More information in case this is hard to duplicate:

  • My gcc version is 4.8.4 (I've also tried it with 4.9)
  • I'm running Linux Mint 17 64-bit
  • The project I'm having this problem with is here. It's largely a pre-processor library, so it's possible that all of the (somewhat convoluted) macros and templates are confusing the linter. This is the specific test file I'm trying to compile.

Thanks so much! This otherwise seems like the best of the atom C++ linters.

Linter - Refers to line numbers that don't exist

I have linter 1.11.4 and linter-gcc 0.6.8 on Atom 1.6.0. Also, here is the output from gcc --version:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix

I am new to Atom/PlatformIO but have got everything basically working in that I can compile projects, upload Arduinos, etc with no problems. But I am having problems with lint. This is what I see:
#1 Lint reports issues to line numbers that do not exist. These, of course, are all beyond the last line in the file.
#2 Lint is reporting errors that are flagged at lines that have no code or can't possibly have the errors indicated.

There are no messages from the console, I have tried various installs and updates, but to no avail.

The attached png shows lint pointing into the middle of some comments delineated by /* */
screen shot 2016-03-25 at 8 05 59 am

Enviroment variables in include path.

Checklist

  • [x ] Check that you have the GNU C Compiler installed by typing gcc --version into a terminal.
  • [x ] 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.
  • [ x] Ensure that you are using a valid grammar - either C/C++/C++14

Issue (including debugging messages):

I'm trying to include an environmental variable in the .gcc-flags.json without success.
Current .gcc-flags.json

{
  "execPath": "gcc",
  "gccDefaultCFlags": "-Wall",
  "gccDefaultCppFlags": "-Wall -std=c++11",
  "gccErrorLimit": 15,
  "gccIncludePaths": ".,$PATHTO\the\thing",
  "gccSuppressWarnings": true
}

Cannot read property 'binary' of undefined

I get the error message "Cannot read property 'binary' of undefined" using latest version of Linter, Atom and Windows 10.

GCC 4.9.3 is installed, and it's working when I compile from command line.

Trying to make it work with C++11.

My GCC path is "C:\MinGW\bin". Also tried that in the Linter GCC settings but to no success.

Failed to activate the linter-gcc package

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.2.4
System: Unknown Windows Version
Thrown From: linter-gcc package, v0.5.0

Stack Trace

Failed to activate the linter-gcc package

At Cannot find module 'atom-linter'

Error: Cannot find module 'atom-linter'
    at Module._resolveFilename (module.js:336:15)
    at Function.Module._resolveFilename (C:\Users\csd\AppData\Local\atom\app-1.2.4\resources\app.asar\src\module-cache.js:383:52)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.provideLinter (C:/Users/csd/.atom/packages/linter-gcc-0.5.0/lib/main.js:43:21)
    at Package.module.exports.Package.activateServices (C:\Users\csd\AppData\Local\atom\app-1.2.4\resources\app.asar\src\package.js:327:69)
    at Package.module.exports.Package.activateNow (C:\Users\csd\AppData\Local\atom\app-1.2.4\resources\app.asar\src\package.js:173:16)
    at C:\Users\csd\AppData\Local\atom\app-1.2.4\resources\app.asar\src\package.js:150:32
    at Package.module.exports.Package.measure (C:\Users\csd\AppData\Local\atom\app-1.2.4\resources\app.asar\src\package.js:92:15)

Commands

Config

{
  "core": {
    "themes": [
      "atom-material-ui",
      "atom-material-syntax"
    ],
    "disabledPackages": [
      "linter-gcc",
      "linter-gcc",
      "linter-gcc",
      "linter-gcc",
      "linter-gcc"
    ]
  }
}

Installed Packages

# User
No installed packages

# Dev
No dev packages

Join AtomLinter.

This is such a great package with such an active user base. Would you like to join us over at @AtomLinter?

Joining us would ensure that your package is maintained if you ever lose interest or just get busy with other projects. As well, making sure that this is kept up to date with any API changes or improvements.

/cc @steelbrain

Custom compiler in .gcc-flags.json

[Enter steps to reproduce below:]

  1. Modify .gcc-flags.json in project root directory to:
{
  "execPath": "arm-none-eabi-g++",
  "gccIncludePaths": "./include"
}

Changing the execPath globally via the Settings pane works fine. If I change arm-none-eabi-gcc to just gcc, I get "gcc" not found as expected since gcc is not on my PATH but arm-none-eabi-gcc is

Atom Version: 1.5.4
System: Microsoft Windows 10 Education
Thrown From: linter-gcc package, v0.6.8

Stack Trace

Uncaught TypeError: Cannot read property 'trim' of undefined

At C:\Users\Elliot\.atom\packages\linter-gcc\lib\utility.js:45

TypeError: Cannot read property 'trim' of undefined
    at Object.module.exports.splitStringTrim (C:\Users\Elliot\.atom\packages\linter-gcc\lib\utility.js:45:14)
    at Object.module.exports.buildCommand (C:\Users\Elliot\.atom\packages\linter-gcc\lib\utility.js:100:37)
    at Object.lint (C:/Users/Elliot/.atom/packages/linter-gcc/lib/main.js:74:36)
    at lintOnTheFly (C:/Users/Elliot/.atom/packages/linter-gcc/lib/main.js:124:22)
    at Function.module.exports.Emitter.simpleDispatch (C:\Users\Elliot\AppData\Local\atom\app-1.5.4\resources\app.asar\node_modules\event-kit\lib\emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (C:\Users\Elliot\AppData\Local\atom\app-1.5.4\resources\app.asar\node_modules\event-kit\lib\emitter.js:125:28)
    at C:\Users\Elliot\AppData\Local\atom\app-1.5.4\resources\app.asar\node_modules\text-buffer\lib\text-buffer.js:1321:25

Commands

     -1:50.9.0 core:save (atom-text-editor.editor.is-focused)
  3x -1:47.7.0 core:backspace (atom-text-editor.editor.autocomplete-active.is-focused)
     -0:27.1.0 core:save (atom-text-editor.editor.is-focused)
  2x -0:25 core:backspace (atom-text-editor.editor.autocomplete-active.is-focused)
     -0:21.3.0 autocomplete-plus:cancel (atom-text-editor.editor.autocomplete-active.is-focused)
     -0:19.7.0 core:cancel (a.stack-toggle)
  4x -0:16.3.0 core:backspace (atom-text-editor.editor.autocomplete-active.is-focused)
     -0:12.5.0 core:save (atom-text-editor.editor.is-focused)
  2x -0:10.4.0 core:backspace (atom-text-editor.editor.autocomplete-active.is-focused)
  3x -0:08.4.0 autocomplete-plus:cancel (atom-text-editor.editor.autocomplete-active.is-focused)
     -0:06.0 core:cancel (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)
     -0:04.4.0 core:move-up (atom-text-editor.editor.autocomplete-active.is-focused)
     -0:04.0 editor:move-to-end-of-screen-line (atom-text-editor.editor.autocomplete-active.is-focused)
  2x -0:03.8.0 core:backspace (atom-text-editor.editor.autocomplete-active.is-focused)
     -0:03.1.0 markdown-writer:insert-new-line (atom-text-editor.editor.autocomplete-active.is-focused)
     -0:03.1.0 editor:newline (atom-text-editor.editor.autocomplete-active.is-focused)

Config

{
  "core": {
    "audioBeep": false,
    "autoHideMenuBar": true,
    "disabledPackages": [
      "color-picker",
      "jekyll",
      "language-cmake",
      "pigments",
      "symbols-view"
    ],
    "themes": [
      "one-dark-ui",
      "base16-tomorrow-dark-theme"
    ]
  },
  "linter-gcc": {
    "execPath": "arm-none-eabi-gcc",
    "gccDebug": true,
    "gccIncludePaths": "./include",
    "gccLintOnTheFly": true
  }
}

Installed Packages

# User
atom-beautify, v0.28.26
atom-ctags, v4.5.0
file-icons, v1.6.18
language-doxygen, v0.2.1
linter, v1.11.3
linter-gcc, v0.6.8
markdown-writer, v2.3.2
minimap, v4.20.0
wakatime, v5.0.8

# Dev
No dev packages

Error: unable to open output file 'main.o': 'Permission denied'

Linter-gcc fails to work for my C project. Instead, a single error is presented:

  unable to open output file 'main.o': 'Permission denied'

Environment: Atom on MacOS X 10.11.2 (latest). Linter-Gcc v. 0.5.10

Log (from the Dev console):

linter-gcc trying: /Users/USER/rC/proj/src/.gcc-flags.json

/Users/USER/.atom/packages/linter-gcc/lib/config.js:33 linter-gcc trying: /Users/USER/rC/proj/.gcc-flags.json

/Users/USER/.atom/packages/linter-gcc/lib/main.js:124 linter-gcc: gcc -c -g -Wall -O3 -fmax-errors=0 -I/Users/USER/rC/proj -I/Users/USER/rC/proj/lib -I/Users/USER/rC/proj/tmp /Users/USER/rC/proj/src/main.c

.o files in my home directory.

Hi !

I'm trying linter-gcc for the first time using C++ (Used before for C, no problem), and it's making .o files in my home directory. (The same than the file i'm compiling). I hope it's not a dumb problem ^^

Here are my parameters:

  • GCC Executable Path: g++
  • C Flags: -W -Wall -Wextra
  • C++ FLags: -W -Wall -Wextra -pedantic -std=c++11 -c
  • GCC Error Limit : 0
  • GCC Include Path: ./include/,./include/lib/,./include/class/,../../include/,../include/.
  • Suppress GCC Warnings : No

I'm on ArchLinux. using GCC 5.3.0

By the way, i'm having .gch files while compiling .h files that are a bit redudant. Is it possible to delete them automagically ?

Thanks in advance, and sorry for the inconvenience.

Lint on fly does not work

Hello!
I've been trying for a while , without success, to make linter-gcc lint on the fly, not only on save. Is it not a possible feature at this moment? It works fine at file save, but not on the fly. The python linter-flake8 , for example works on the fly. But not the gcc version, nor the javac one but that's another issue.

Linter not working

Hello, Iยดm new to Atom and Iยดm loving it so far but I canยดt get linter working with C, it always says "No issues", I dont know if itยดs this package linter-gcc or linter itself, Iยดve googled everywhere but I canยดt find the solution.

Any help is much appreciated

Thanks!

Errors not detected when g++ is not in system path (Windows)

I have correctly the Exec Path to match the location of g++ (mingw-w64) on my Windows 10 machine:

C:/Program Files/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/bin/g++

However, the linter always reports "No Issues."

Alternatively, if I startup Atom with the g++ directory in the system path, the linter correctly detect errors. It seems that the Exec Path setting is not working?

Uncaught SyntaxError: /home/hgst/dev/mp/.gcc-flags.json: Unexpected string

[Enter steps to reproduce below:]

  1. Made change in file
  2. Attempted to save file

Atom Version: 1.7.3
System: Debian GNU/Linux
Thrown From: linter-gcc package, v0.6.14

Stack Trace

Uncaught SyntaxError: /home/hgst/dev/mp/.gcc-flags.json: Unexpected string

At /usr/share/atom/resources/app.asar/src/pane.js:1002

SyntaxError: /home/hgst/dev/mp/.gcc-flags.json: Unexpected string
    at Object.parse (native)
    at Object.Module._extensions..json (module.js:440:27)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (/usr/share/atom/resources/app.asar/src/native-compile-cache.js:50:27)
    at Object.module.exports.settings (/home/hgst/.atom/packages/linter-gcc/lib/config.js:49:25)
    at Object.module.exports.buildCommand (/home/hgst/.atom/packages/linter-gcc/lib/utility.js:91:23)
    at Object.lint (/home/hgst/.atom/packages/linter-gcc/lib/main.js:93:36)
    at lintOnSave (/home/hgst/.atom/packages/linter-gcc/lib/main.js:154:22)
    at Function.module.exports.Emitter.simpleDispatch (/usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at TextBuffer.module.exports.TextBuffer.saveAs (/usr/share/atom/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1113:27)
    at TextBuffer.module.exports.TextBuffer.save (/usr/share/atom/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1083:19)
    at TextEditor.module.exports.TextEditor.save (/usr/share/atom/resources/app.asar/src/text-editor.js:660:26)
    at Pane.module.exports.Pane.saveItem (/usr/share/atom/resources/app.asar/src/pane.js:718:18)
    at Pane.module.exports.Pane.saveActiveItem (/usr/share/atom/resources/app.asar/src/pane.js:701:19)
    at Workspace.module.exports.Workspace.saveActivePaneItem (/usr/share/atom/resources/app.asar/src/workspace.js:684:35)
    at atom-workspace.commandRegistry.add.core:save (/usr/share/atom/resources/app.asar/src/register-default-commands.js:214:32)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app.asar/src/command-registry.js:260:29)
    at /usr/share/atom/resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/usr/share/atom/resources/app.asar/src/window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (/usr/share/atom/resources/app.asar/src/window-event-handler.js:3:61)

Commands

     -0:23.8.0 core:copy (atom-text-editor.editor.is-focused)
     -0:11.3.0 editor:newline (atom-text-editor.editor.is-focused)
     -0:10.6.0 core:paste (atom-text-editor.editor.is-focused)
     -0:05.0 core:move-left (atom-text-editor.editor.is-focused)
     -0:04.9.0 snippets:next-tab-stop (atom-text-editor.editor.is-focused)
     -0:04.9.0 snippets:expand (atom-text-editor.editor.is-focused)
     -0:04.9.0 editor:indent (atom-text-editor.editor.is-focused)
     -0:00.4.0 core:save (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "audioBeep": false,
    "disabledPackages": [
      "autocomplete-ctags",
      "language-ruby",
      "language-ruby-on-rails",
      "language-sass",
      "language-php",
      "language-perl",
      "language-objective-c",
      "language-mustache",
      "language-javascript",
      "language-java",
      "language-toml",
      "language-yaml",
      "open-on-github",
      "atom-rtags",
      "atomic-rtags",
      "symbols-view",
      "epitools"
    ]
  },
  "linter-gcc": {
    "execPath": "/usr/bin/gcc",
    "gccDefaultCFlags": "-c -Wall -fsyntax-only",
    "gccDefaultCppFlags": "-c -Wall -fsyntax-only"
  }
}

Installed Packages

# User
atom-ctags, v4.5.2
linter, v1.11.4
linter-gcc, v0.6.14
terminal-plus, v0.14.5

# Dev
No dev packages

#pragma once warning

Hey ๐Ÿ˜‰

When I try to lint a header file (with extension .h), the linter will give me the following warning:
warning: #pragma once in main file. When I switch to the default include guards, gcc will not output this error, however my project has over 100 header files and I don't want to switch from #pragma once to the include guards.

Do you have any help? Thanks in advance.

linter-gcc does not work

Hello, I have installed linter, linter-gcc but it's not work for .c file. linter-clang is worked.

gcc --version 
gcc (GCC) 5.3.0
Atom version is 1.6.0
linter-gcc version is 0.6.8

Console message:

linter-gcc: Using configuration page settings
linter-gcc config: {"execPath":"/usr/bin/gcc","gccIncludePaths":" ","gccSuppressWarnings":false,"gccDefaultCFlags":"-c -Wall","gccDefaultCppFlags":"-c -Wall -std=c++11","gccErrorLimit":0}
linter-gcc: /usr/bin/gcc -c -Wall -fmax-errors=0 /home/test/temp2/hex2dd.c

I've googled but can't figure out. Any help is much appreciated.

Thanks a lot.

Does not lint

Set my exec path to c:\tools\ARM-GCC\arm-none-eabi\bin where gcc.exe, ldd.exe, etc, is at. But no linting.

I'm on Windows 7 so I'm a bit lost as to how to debug this.

permission error

when i save the file it shows this output :
"errors=0'
error: unable to open output file: Permission denied"
1 error generated"
capture d ecran 2016-01-30 a 16 20 09
i see in the terminal that the output file is not created.
how can i add the permission to create the file or make the error message invisible ?

Uncaught TypeError with gcc-flags.json

EDIT:
The error occurs with on-the-fly-linting disabled, too.
I also included another Stacktrace.


Hi,
I got a problem with on the fly linting and gcc-flags.json. I don't really know, if it depends ony my setup. But think it's not that exotic, so I decided to post in here.
If I don't use gccIncludePaths, obviously gcc can not find my header files: "RunMgr.hpp no such file or directory".
my setup: .gcc-flags.json in project directory, sourcefiles in .src/

./gcc-flags.json
./src/runMgr.cpp
./src/runMgr.hpp

with the following .json file, the first error is gone, but a big red atom "Uncaugt TypeError" pops up.

{
    "gccIncludePaths": "./src"
}

I hope you/I can help you/me :)

GCC version: 4.9.2
Atom Version: 1.7.3
System: Ubuntu 15.04
Thrown From: linter-gcc package, v0.6.14

Stack Trace

Uncaught TypeError: Cannot read property 'substring' of undefined

At /home/s5800160/.atom/packages/linter-gcc/lib/utility.js:101

TypeError: Cannot read property 'substring' of undefined
    at Object.module.exports.buildCommand (/home/s5800160/.atom/packages/linter-gcc/lib/utility.js:101:16)
    at Object.lint (/home/s5800160/.atom/packages/linter-gcc/lib/main.js:93:36)
    at lintOnTheFly (/home/s5800160/.atom/packages/linter-gcc/lib/main.js:146:22)
    at Function.module.exports.Emitter.simpleDispatch (/usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at /usr/share/atom/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1378:25

Commands

     -0:09.3.0 grammar-selector:show (atom-text-editor.editor.is-focused)
     -0:07.1.0 window:toggle-dev-tools (atom-text-editor.editor.is-focused)
     -0:03.3.0 editor:newline (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "build",
      "activate-power-mode",
      "atom-beautify",
      "gpp-compiler"
    ],
    "themes": [
      "atom-dark-ui",
      "one-dark-syntax"
    ]
  },
  "linter-gcc": {
    "gccDebug": true,
    "gccDefaultCFlags": "-Wall",
    "gccDefaultCppFlags": "-std=c  11 -Wall",
    "gccLintOnTheFly": true
  }
}

Installed Packages

# User
autocomplete-clang, v0.9.3
counter, v0.3.3
language-doxygen, v0.2.1
linter, v1.11.4
linter-clang, v3.4.4
linter-cppcheck, v0.2.0
linter-gcc, v0.6.14

# Dev
No dev packages

Stacktrace # 2

Atom Version: 1.7.3
System: Ubuntu 15.04
Thrown From: linter-gcc package, v0.6.14

Stack Trace

Uncaught TypeError: Cannot read property 'substring' of undefined

At /usr/share/atom/resources/app.asar/src/pane.js:1002

TypeError: Cannot read property 'substring' of undefined
    at Object.module.exports.buildCommand (/home/s5800160/.atom/packages/linter-gcc/lib/utility.js:101:16)
    at Object.lint (/home/s5800160/.atom/packages/linter-gcc/lib/main.js:93:36)
    at lintOnSave (/home/s5800160/.atom/packages/linter-gcc/lib/main.js:154:22)
    at Function.module.exports.Emitter.simpleDispatch (/usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at TextBuffer.module.exports.TextBuffer.saveAs (/usr/share/atom/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1113:27)
    at TextBuffer.module.exports.TextBuffer.save (/usr/share/atom/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1083:19)
    at TextEditor.module.exports.TextEditor.save (/usr/share/atom/resources/app.asar/src/text-editor.js:660:26)
    at Pane.module.exports.Pane.saveItem (/usr/share/atom/resources/app.asar/src/pane.js:718:18)
    at Pane.module.exports.Pane.saveActiveItem (/usr/share/atom/resources/app.asar/src/pane.js:701:19)
    at Workspace.module.exports.Workspace.saveActivePaneItem (/usr/share/atom/resources/app.asar/src/workspace.js:684:35)
    at atom-workspace.commandRegistry.add.core:save (/usr/share/atom/resources/app.asar/src/register-default-commands.js:214:32)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app.asar/src/command-registry.js:260:29)
    at /usr/share/atom/resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/usr/share/atom/resources/app.asar/src/window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (/usr/share/atom/resources/app.asar/src/window-event-handler.js:3:61)

Commands

     -0:27.4.0 editor:newline (atom-text-editor.editor.is-focused)
     -0:26.7.0 core:save (atom-text-editor.editor.is-focused)
     -0:24.3.0 core:backspace (atom-text-editor.editor.is-focused)
  3x -0:23.4.0 core:save (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "build",
      "activate-power-mode",
      "atom-beautify",
      "gpp-compiler"
    ],
    "themes": [
      "atom-dark-ui",
      "one-dark-syntax"
    ]
  },
  "linter-gcc": {
    "gccDebug": true,
    "gccDefaultCFlags": "-Wall",
    "gccDefaultCppFlags": "-std=c++11 -Wall"
  }
}

Installed Packages

# User
autocomplete-clang, v0.9.3
counter, v0.3.3
language-doxygen, v0.2.1
linter, v1.11.4
linter-clang, v3.4.4
linter-cppcheck, v0.2.0
linter-gcc, v0.6.14

# Dev
No dev packages

"*.gch" files created during lint

For some reason, while saving header files in my C project, the linter is creating a "file.h.gch" file in the project tree.

This happens only for header files. C files don't generate anything.

Uncaught TypeError: Path must be a string. Received undefined

Hello, I have encountered the following exception:

Atom Version: 1.7.2
System: linux 4.5.1-1-ARCH
Thrown From: linter-gcc package, v0.6.12

Stack Trace

Uncaught TypeError: Path must be a string. Received undefined

At path.js:8

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:8:11)
    at Object.posix.join (path.js:479:5)
    at /home/bailly_j/.atom/packages/linter-gcc/lib/utility.js:66:34
    at Array.forEach (native)
    at Object.module.exports.splitStringTrim (/home/bailly_j/.atom/packages/linter-gcc/lib/utility.js:62:14)
    at Object.module.exports.buildCommand (/home/bailly_j/.atom/packages/linter-gcc/lib/utility.js:132:40)
    at Object.lint (/home/bailly_j/.atom/packages/linter-gcc/lib/main.js:92:36)
    at lintOnTheFly (/home/bailly_j/.atom/packages/linter-gcc/lib/main.js:145:22)
    at Function.module.exports.Emitter.simpleDispatch (/usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at /usr/share/atom/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1369:25

Commands

     -0:07.5.0 grammar-selector:show (atom-text-editor.editor)

Config

{
  "core": {
    "disabledPackages": [
      "linter-clang"
    ]
  },
  "linter-gcc": {
    "execPath": "gcc",
    "gccDebug": true,
    "gccDefaultCFlags": "-only -c -W -Wall -Wextra -pedantic -posix -o /dev/null",
    "gccIncludePaths": "./include",
    "gccLintOnTheFly": true
  }
}

Installed Packages

# User
epitech-headers, v0.2.8
epitech-norm-linter, v1.10.0
linter, v1.11.4
linter-gcc, v0.6.12

# Dev
No dev packages

Error in header shown in source file

I've got a CPP file which includes an H file. linter-gcc cannot find the header included in the H file at line 3. In Atom, it shows an error against line 3 of the CPP file against a different #include:

Header.h file:

#pragma once

#include <missing_header.h>  <<<<<< No error shown here
...

CPP file:

#include "Header.h"

#include <AnotherHeader.h> <<<< Error shown here
...

Linting with gfortran

Would it be possible to lint fortran code using gfortran with this package? Would it make sense to incorporate fortran linting here, or to fork this package to create a fortran linter ?

Project config replaces user config

If you start working on a project that does not have a .gcc-flags.json file after working on one that does, it'll use the configuration from the previous project. This appears to be a permanent modification to the user's settings (through atom.config.set).

config.js also sets every attribute from the config file, even if some aren't present. This means that omitting execPath from .gcc-flags.json to let the user use their own, correct path will reset execPath to the default (/usr/bin/g++).

I have an error

erdem

I tried hundred times but linter gcc is not workin, I need help please

"file" is read-only

SyntaxError: /home/guy/.atom/packages/linter-gcc/lib/main.js: Line 78: "file" is read-only
76 | editor = atom.workspace.getActivePaneItem();
77 | if (editor) {

78 | file = editor.buffer.file;
| ^
79 | if (file) {
80 | cwd = file.getParent().getPath();
81 | }
at File.errorWithNode (/opt/atom/resources/app.asar/node_modules/babel-core/lib/babel/transformation/file/index.js:451:13)
at checkPath (/opt/atom/resources/app.asar/node_modules/babel-core/lib/babel/transformation/transformers/es6/constants.js:33:16)
at NodePath.AssignmentExpression (/opt/atom/resources/app.asar/node_modules/babel-core/lib/babel/transformation/transformers/es6/constants.js:38:3)
at NodePath.call (/opt/atom/resources/app.asar/node_modules/babel-core/lib/babel/traversal/path/context.js:130:26)
at NodePath.visit (/opt/atom/resources/app.asar/node_modules/babel-core/lib/babel/traversal/path/context.js:154:8)
at TraversalContext.visitSingle (/opt/atom/resources/app.asar/node_modules/babel-core/lib/babel/traversal/context.js:92:12)
at TraversalContext.visit (/opt/atom/resources/app.asar/node_modules/babel-core/lib/babel/traversal/context.js:104:19)
at Function.traverse.node (/opt/atom/resources/app.asar/node_modules/babel-core/lib/babel/traversal/index.js:67:17)
at NodePath.visit (/opt/atom/resources/app.asar/node_modules/babel-core/lib/babel/traversal/path/context.js:171:26)
at TraversalContext.visitMultiple (/opt/atom/resources/app.asar/node_modules/babel-core/lib/babel/traversal/context.js:72:16)

Project specific settings

linter-clang now supports .clang_complete files which allows you to inject e.g. -I/path/to/include/dir for each project. As each of my projects at work comes bundled with both include dirs and gcc environment I would love something like this.

I.e. support for project specific settings like exec path and include dirs.

RangeError: invalid string length

Trying to save a *.hpp file and getting this error every time:

RangeError: Invalid string length
    at Object.stringify (native)
    at /Users/vision/.atom/packages/linter/lib/validate.coffee:53:25
    at Array.forEach (native)
    at Object.module.exports.Validate.messages (/Users/vision/.atom/packages/linter/lib/validate.coffee:27:14)
    at MessageRegistry.set (/Users/vision/.atom/packages/linter/lib/message-registry.js:36:16)
    at /Users/vision/.atom/packages/linter/lib/linter.coffee:35:17
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at /Users/vision/.atom/packages/linter/lib/indie-registry.js:27:20
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at Indie.setMessages (/Users/vision/.atom/packages/linter/lib/indie.js:15:18)
    at /Users/vision/.atom/packages/linter-gcc/lib/main.js:75:35

Specifying -std on C Flags breaks linting

When I specify the standard I want to lint against in the Gcc Default C Flags, the whole linter doesn't lint anything anymore.

I used this syntax :

-Wall -std=c90

With only -Wall, a missing semi-colon shows up as an error. When adding -std=c90, everything is reported as fine.

I don't have any code to test for C++.

Feature request - per-directory and per-file settings

Hello!

I would like to discuss a potential new feature - per-directory and per-file settings. Would any of these be at all possible and wanted? I would certainly appreciate a feature like that - in bigger projects I quite often have additional flags for some folder trees, sometimes there's a need to have specific compiler flags for some selected source files.

The first variant - per-directory - would probably fit well with the concept of .gcc-flags.json file. Personally I imagine a feature like that would apply flags from .gcc-flags.json file to files in this folder and all subfolders. I suppose that top-level .gcc-flags.json file should provide "global" settings and .gcc-flags.json files in other folders could append some other flags (in case of gccDefaultCFlags, gccDefaultCppFlags and gccIncludePaths) or override values (in case of execPath, gccErrorLimit and gccSuppressWarnings). However it would be nice if there would be a switch that would allow all settings to be overridden. I guess this could take a form of different name of the file with settings - for example .gcc-flags-top.json would contain "top-level" options - no file "above" this one would need to be parsed.

The second variant - per-file - seems a little more complicated to fit nicely with the files with settings, but I guess this would also be possible.

linter-gcc not working on Mac OS X

Hi,
I'm new to Atom and I was trying to use linter-gcc on my mac, but I'ts not working on my C file. I've searched this on google, but I can't find the solution!

Any help?
Thanks guys

captura de tela 2016-04-03 as 18 58 56

issue for syntax checking

Platform: darwin

I installed

atom 1.3.2

linter 1.11.3

linter-gcc 0.5.9

osx 10.11.2

gcc

Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix

when I save my helloworld.c for linter to check the syntax, I got below error

errors=0'
error: unable open output file 'helloworld.o': 'Permission defied'
1 error generated.

I checked the command line in console, it is:
/usr/bin/gcc -c -Wall -std=gnu99 -fmax-errors=0 /myfolder/helloworld.c

I ran the command line in a terminal, helloword.o is generated in current folder.

this package was working in previous version of atom/linter/linter-gcc, but in this version it doesn't work.

could you check where did you set the default folder to compile the c program and from where do you read the .o file?

Linter just doesn't work.

I have windows 10, cpp project, i have set correct path to compiler "C:\Qt\Tools\mingw492_32\bin\g++", added it to the system path varible, base linter is installed.
And nothing happens... 0 issues in bottom deck, in console panel i also don't see anything.
Did i forgot anything to make linter work?

gcc does not recognize -fmax-errors

I have got an older version of GCC (gcc version 4.1.2 (Altera 11.1 Build 173)), which does not recognize the -fmax-errors=0 option, which gets added by linter-gcc:

cc1.exe: error: unrecognized commandline option "-fmax-errors=0"

Would it be possible to add an option to disable this, so that linter-gcc does not add this flag?

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.