platformio / platform-native

Native: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/native
Apache License 2.0
21 stars 27 forks source link

g++ not found #1

Closed palivoda closed 2 years ago

palivoda commented 6 years ago

For Native Environment - run command outputs:

platformio run Verbose mode can be enabled via -v, --verbose option PLATFORM: Native > SYSTEM: Library Dependency Finder -> http://bit.ly/configure-pio-ldf LDF MODES: FINDER(chain) COMPATIBILITY(light) Collected 0 compatible libraries Scanning dependencies...

No dependencies Compiling .pioenvs\native\src\main.o 'g++' is not recognized as an internal or external command, operable program or batch file. *** [.pioenvs\native\src\main.o] Error 1

It's Windows 7. PlatformIO 3.5.3a7.
In PowerShell console in Atom it also says the same.

While in command prompt g++ is found. Its in path.

Platformio reinstall does not help.

Can you give me a clue where to dig? :)

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/86248427-g-not-found?utm_campaign=plugin&utm_content=tracker%2F38216179&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F38216179&utm_medium=issues&utm_source=github).
azeemshatp commented 5 years ago

How did you fix this issue? I have the same problem in Windows 10, platformio powershell. I can access g++ from the command line and not from the PIO powershell.

palivoda commented 5 years ago

Unfortunetely I did not found. Maybe you are lucky.

On Wed, 6 Nov 2019 at 13:14, azeemshatp notifications@github.com wrote:

How did you fix this issue? I have the same problem in Windows 10, platformio powershell. I can access g++ from the command line and not from the PIO powershell.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/platformio/platform-native/issues/1?email_source=notifications&email_token=AAFE3LSVQUOWGUHHT5LKEQLQSKRJ7A5CNFSM4EXPLQD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDGF6SA#issuecomment-550264648, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFE3LWLU7FEQNGRLPBXE33QSKRJ7ANCNFSM4EXPLQDQ .

ivankravets commented 4 years ago

Please add bin folder of your local toolchain to system PATH environment variable in OS. For example, C:\\MinGW\\bin

mayurpawar2871 commented 4 years ago

Processing in native environment as i don't hardware [.pio/build/native/test/test.o] Error 1 please guide

ivankravets commented 4 years ago

Could you share a simple project to reproduce this issue?

felixplum commented 2 years ago

Hi, I faced a similar issue and found a simple workaround:

Take a look at

C:\Users\$USERNAME\.platformio\platforms\native\builder\main.py

and add the two lines

import os 
os.environ["PATH"] += ";" + r"C:\Program Files\mingw64\bin"

or wherever your mingw64 is located. A clean solution would allow appending $PATH or buildchain-configs via the platformio.ini.

Once that is set up, create a sample test file test/test_main.cpp with content

#include <unity.h>

void test_setup(void)
{
    TEST_ASSERT(true);
}

int main(int argc, char **argv)
{
    UNITY_BEGIN();

    RUN_TEST(test_setup);

    UNITY_END();

    return 0;
}

Happy testing!

ivankravets commented 2 years ago

Hi, @felixplum ,

The proper solution is to add C:\Program Files\mingw64\bin to your system environment PATH variable..

felixplum commented 2 years ago

Hey Ivan,

That directory is in the PATH and gcc can be executed outside of the PlatformIO-environment, similarly to OP. See also: https://community.platformio.org/t/g-is-not-recognized/11256/5

I'm using the official IDE with core 5.2.5 under Windows 10.

ivankravets commented 2 years ago

Please disable suspicious/broken VSCode extensions that break the global system environment.