NO

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

Ali

  • Guest
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: 2115
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

Ali

  • Guest
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: 2113
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.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Ali

  • Guest
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: 2115
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

Ali

  • Guest
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?

danz68

  • Guest
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: 2113
Re: Unable to find or execute POCC.EXE
« Reply #8 on: February 08, 2019, 01:14:57 PM »
Enclose paths in double quotes.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

danz68

  • Guest
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: 2113
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.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide