NO

Author Topic: Unable to find or execute POCC.EXE  (Read 1229 times)

Offline Ali

  • Member
  • *
  • Posts: 4
Unable to find or execute POCC.EXE
« on: July 28, 2018, 11:40:18 am »
Hi
My name is Ali,

I would like to thank you for this awesome C compiler. I use it on daily basis and I couldn’t find any other alternative on Windows. But, I have a little problem. Whenever I try to compile a C file from the PowerShell, an error message would pop saying “Unable to find or execute POCC.EXE.”
Here is the line I use for compilation:
cc -Tamd64-coff name.c

The problem only happens with the PowerShell, it works fine with the CMD. I tried both the 8.00 and the newer 9.00 BETA version but still, without any luck.

I have the environment set right, and I use visual code as my text editor.

Any suggestion would be much appreciated

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1828
Re: Unable to find or execute POCC.EXE
« Reply #1 on: July 28, 2018, 12:03:13 pm »
CC works in Win 8.1 using full path for cc.exe
or using
$env:Path += ";C:\code\PellesC9\bin"

EDIT:
cc.exe have a problem in Windows 10 with Path with spaces in path.
cc mess extension with random chars in pocc filename, like pocc.e???.

PowerShell needs a special way to call program from "C:\Program Files\"
C:\Program` Files\PellesC9\bin\cc.exe
« Last Edit: July 28, 2018, 01:58:32 pm by TimoVJL »
May the source be with you

Offline Ali

  • Member
  • *
  • Posts: 4
Re: Unable to find or execute POCC.EXE
« Reply #2 on: July 28, 2018, 12:15:41 pm »
It works fine on Windows 10 too, but not with PowerShell

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1699
Re: Unable to find or execute POCC.EXE
« Reply #3 on: July 28, 2018, 01:37:47 pm »
PwerShell uses the environment inherited from the calling process.
If the calling process change the environment or specifically alter the %PATH% variable removing the references to PellesC binaries you'll not be able to access them.
If you have correctly set the global (system) environment, try to launch PowerShell from the system (i.e. start menu) it should work.
Keep in mind that path and other system settings can be delayed on change so just modifying the system PATH and launch PowerShell from system can require a restart of explore.exe or simply a reboot.

Offline Ali

  • Member
  • *
  • Posts: 4
Re: Unable to find or execute POCC.EXE
« Reply #4 on: July 28, 2018, 01:54:29 pm »
I have the path set to:
C:\Program Files\PellesC\Bin

I have also tried to reboot and lunch the PowerShell from the start menu, but nothing seems to work.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1828
Re: Unable to find or execute POCC.EXE
« Reply #5 on: July 28, 2018, 02:03:33 pm »
You could make a copy of PellesC to path without spaces and test it there
Also create a bug report for cc.exe usage in PowerShell.

EDIT: for PowersHell experts: how to execute :D
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64\cl.exe
« Last Edit: July 28, 2018, 04:08:12 pm by TimoVJL »
May the source be with you

Offline Ali

  • Member
  • *
  • Posts: 4
Re: Unable to find or execute POCC.EXE
« Reply #6 on: July 28, 2018, 02:15:29 pm »
And it worked! I have made a copy without the spaces and it works just fine. I wonder why the PowerShell messes with the spaces like that....is it a bug in PowerShell? or is it the way it works?

Offline danz68

  • Member
  • *
  • Posts: 2
Re: Unable to find or execute POCC.EXE
« Reply #7 on: February 08, 2019, 11:20:54 am »
I am trying to run cc.exe (with full path) with correct arguments from command line (not Power Shell). I confirm that if the path of cc.exe has spaces in it, it doesn't run (Unable to find or execute POCC.EXE). This does not happen when the whole environment is installed in a path without spaces. Then it runs just fine.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1699
Re: Unable to find or execute POCC.EXE
« Reply #8 on: February 08, 2019, 01:14:57 pm »
Enclose paths in double quotes.

Offline danz68

  • Member
  • *
  • Posts: 2
Re: Unable to find or execute POCC.EXE
« Reply #9 on: February 10, 2019, 09:08:43 am »
that's what I did. it seems cc.exe does not invoke pocc with double quotes paths. Eventually I gave up using "cc" and used directly pocc with double quotes paths and that worked.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1699
Re: Unable to find or execute POCC.EXE
« Reply #10 on: February 10, 2019, 11:32:47 am »
The internal processing of cc could add quotes, or using a CreteProcess() function the executable path is taken directly without need of quotes.
The driver compiler command cc is something coming from long time ago, and can conflict if you have more different compilers installed. To use pocc directly is the preferred solution.