Giter VIP home page Giter VIP logo

Comments (20)

hebaishi avatar hebaishi commented on August 16, 2024 2

Hello. I'm gonna upload a guide for Windows users today because it seems a large number of users have this problem.

What you need to do is:

  1. Set the linter-gcc executable path to g++.exe or gcc.exe
  2. Add your MinGW bin to the system path by following the instructions here. Note that you need to add the MinGW bin path to the end. So if your PATH variable reads C:\Windows\, and your MinGW bin path is C:\MinGW\bin, your new PATH variable should read C:\Windows\;C:\MinGW\bin. Note the use of the semicolon separator.

Once you have made this change, linter-gcc should work.

from linter-gcc.

hebaishi avatar hebaishi commented on August 16, 2024

Hello. Could you please do the following: open the javascript console in atom, and look for the linter-gcc messages. It prints all its command-line parameters to the console, so the first thing to do is to copy those parameters and try to run them directly in the command-line.

from linter-gcc.

Nachot93 avatar Nachot93 commented on August 16, 2024

I am so sorry but I don't know how to do that, I toggled developer tools but I don't know what to do from there, can you guide me through the process if it isn't much trouble?
Thanks again

from linter-gcc.

hebaishi avatar hebaishi commented on August 16, 2024

Of course. With 'developer tools' on, you should see a sidebar, and at the bottom of this sidebar you'll see a button that says 'console'. Click it to view the console. Then go back to your C/C++ source file, and press Ctrl+S to save and trigger the linter. When you do this, you'll see something like this appear in the console:

/usr/bin/g++
["-Wall", "-std=c++0x", "-fmax-errors=0",
"-I/home/husam/.atom/packages/linter-gcc", "/tmp/sample.cpp"]

These are your command-line parameters. The first is the g++ binary, and the rest is the parameters given to g++. So, if we consider the example above, my full command would be:

/usr/bin/g++ -Wall -std=c++0x -fmax-errors=0 -I/home/husam/.atom/packages/linter-gcc /tmp/sample.cpp

You need to reconstruct your command in this way and run it in your terminal/command prompt to find out what g++/gcc is reporting.

from linter-gcc.

Nachot93 avatar Nachot93 commented on August 16, 2024

Okay, I got this:

/usr/bin/g++
main.js:149 ["-Wall", "-fmax-errors=0", "C:\Users\Nacho-PC2\Documents\TP FINAL.cpp"]

Then I changed it to this:

/usr/bin/g++main.js:149 -Wall, -fmax-errors=0, C:\Users\Nacho-PC2\Documents\TP FINAL.cpp

I have Windows, so I assume you mean put that in the cmd, I did that from the .atom directory (don´t know if this is right) and it says "The system cannot find the path specified."

I surely must be doing something wrong.
Damn, I hate being new to stuff :P

from linter-gcc.

hebaishi avatar hebaishi commented on August 16, 2024

Ok there are a few problems here:

  1. You need to remove the main.js:149 from your command. You also need to remove all the commas.
  2. It looks like you are trying to run /usr/bin/g++. Windows does not have a /usr/bin so this probably won't work on windows. You need to go into the linter-gcc configuration page and put the full location of the g++ binary in there. If you don't have one, I suggest you look at installing something something like mingw on windows.
  3. Secondly, you have a space in your file path. This will cause problems because a file path with spaces will cause gcc/g++ to parse part of your file path as a parameter, which it will complain about. To get around this problem, either change your file path and replace ALL spaces with underscores, or enclose the path within double quotes.

from linter-gcc.

Nachot93 avatar Nachot93 commented on August 16, 2024

Okay

  1. Done:

/usr/bin/g++ -Wall -fmax-errors=0 C:\Users\Nacho-PC2\Documents\TPFINAL.cpp

  1. I already have MinGW, so I guess the path that I´m looking for is:

C:\MinGW\bin\g++.exe

Right?

Also, by configuration page, you mean the linter-gcc/lib/main.js? Because I found this in there:

execPath: {
type: "string",
default: "/usr/bin/g++"

Maybe this is the problem?

  1. Done, see 1).

from linter-gcc.

hebaishi avatar hebaishi commented on August 16, 2024

No. That is not it. In the menu bar, click Packages > Settings view. Then click packages on the left and select linter-gcc. There you will find the linter-gcc settings. The first one is the executable path. Set that to your executable path, in your case C:\MinGW\g++.exe.

from linter-gcc.

Nachot93 avatar Nachot93 commented on August 16, 2024

Okay, you left out the bin folder :P
But it´s working now, but the lint on the fly isn´t, I have to save the file for linter to show me the errors, any workaround this?

from linter-gcc.

hebaishi avatar hebaishi commented on August 16, 2024

No, this is deliberate. The reason it works like this is because C/C++ linting can be quite computationally intensive, so linting on-the-fly can cause high CPU load, especially with large files/projects.

from linter-gcc.

Nachot93 avatar Nachot93 commented on August 16, 2024

Ohhhhh, got it, well it's working perfectly now! Thanks a lot! :)

If it's no bother, I've got another question about Atom, but it's not related to linter-gcc, is there a private message button somewhere?

from linter-gcc.

hebaishi avatar hebaishi commented on August 16, 2024

Yes, that's fine. You can send me a message on twitter. My handle is hebaishi_husam. I'm closing this issue.

from linter-gcc.

 avatar commented on August 16, 2024

Hi hebaishi,

I am trying to follow the instructions here to get linter-gcc working in windows and I am not having success. No output displays in the console when I save

from linter-gcc.

 avatar commented on August 16, 2024

Thanks for the response. I did change the executable path to C:\MinGW\bin\g++.exe and also added C:\MinGW\bin to both the path system and user variables. I still don't see anything show up for linter-gcc in the console when I save.

from linter-gcc.

hebaishi avatar hebaishi commented on August 16, 2024

Hello. Your linter-gcc executable path should be set to g++.exe, NOT C:\MinGW\bin\g++.exe. This is because windows needs to find g++.exe in your system path. Also, once you have changed your system PATH in the system properties, you might need to restart Atom for the change to take effect.

from linter-gcc.

 avatar commented on August 16, 2024

great thank you for your reply. It is working now

from linter-gcc.

charozard avatar charozard commented on August 16, 2024

Hi hebaishi,
I'm sorry to bring this back up again but I've encountered a similar problem which appears persistent despite following instructions above. Linter is failing to find a number of standard c++ libraries including string and iostream, though using g++ to compile the same files in terminal works just fine. Do you have any suggestions on remedying this issue? Would the "GCC include paths" setting be the place to look? If so, which path ought I include?

from linter-gcc.

KarateBrot avatar KarateBrot commented on August 16, 2024

Same for me. I followed the instructions. I can compile without errors in Atom but I still get the linter error:
GCC | "iostream: No such file or directory"

from linter-gcc.

AliAytacAyhan avatar AliAytacAyhan commented on August 16, 2024

how to know the path which linter has installed ?

from linter-gcc.

bqUAB avatar bqUAB commented on August 16, 2024

I can confirm that the fix works but after various unsuccessful tries I found my solution for Windows 7.
Follow @hebaishi instructions about the installation of Cygwin and setting the PATH variable.
Test PATH by opening a new CMD and typing gcc –v
Close Atom and GitHub Desktop
Reopen and test if it works now.

from linter-gcc.

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.