Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

gcc, g++, c++ command gives error.

968 views
Skip to first unread message

Solaris BD

unread,
Dec 25, 2008, 11:04:26 AM12/25/08
to
bash$ c++ test.c
cc1plus: /usr/local/include: Permission denied

bash$ cc test.c
/usr/ucb/cc: language optional software package not installed

bash$ g++ test.c
cc1plus: /usr/local/include: Permission denied

bash$ cat test.c
#include <stdio.h>

int main () {
printf("Test\n");
return 0;
}

bash$ echo $PATH
/usr/bin:/usr/openwin/bin:/usr/ucb:/usr/sfw/bin:/opt/sfw/bin

I'm using Solaris 10 update 6. All these are coming when I apply these
commands as regular user. Everything's ok with root user.

To check if the user account has problems I created a new user account
and then tried these commands. It happens all the same. I didn't have
these problems with Solaris 10 update 5.

Tell me how can I fix it.

Colin Paul Gloster

unread,
Dec 25, 2008, 12:47:20 PM12/25/08
to
On Thu, 25 Dec 2008, Solaris BD wrote:

|----------------------------------------------------------------------|

|----------------------------------------------------------------------|

As root, try the two commands
chmod -R a+r /usr/local/include
chmod -R a+x /usr/local/include
and if #include still does not work, then
cd /usr
chmod a+r local
chmod a+x local
chmod a+r local/include
chmod a+x local/include
and if it still has not been solved yet, then
cd /
chmod a+r usr
chmod a+x usr
chmod a+r usr/local
chmod a+x usr/local
.

Perhaps somewhat excessive, but perhaps successful.

Good luck,
Colin Paul Gloster

Solaris BD

unread,
Dec 26, 2008, 3:36:11 AM12/26/08
to
Awesome! Thanks!

Paul Floyd

unread,
Dec 26, 2008, 4:18:34 PM12/26/08
to
On Thu, 25 Dec 2008 08:04:26 -0800 (PST), Solaris BD <Uni...@gmail.com> wrote:
> bash$ c++ test.c
> cc1plus: /usr/local/include: Permission denied

Why are you trying to use a C++ compiler to compile a C file? And is
your 'c++' really /usr/sfw/bin/c++, or some other 'c++'? If the former,
I don't know why it's trying to look in /usr/local. I have no /usr/local
on any of my Solaris machines.

> bash$ cc test.c
> /usr/ucb/cc: language optional software package not installed

You have heard of google, haven't you?

For info, cc and CC are Sun's C and C++ compilers. gcc and g++/c++ are
GNU's C and C++ compilers.

> bash$ cat test.c
> #include <stdio.h>
>
> int main () {

A C main should either take argc/argv arguments or void.

> printf("Test\n");
> return 0;
> }
>
> bash$ echo $PATH
> /usr/bin:/usr/openwin/bin:/usr/ucb:/usr/sfw/bin:/opt/sfw/bin

Unless you are working with old old BSD code, put /usr/ucb at the end of
your PATH (or remove it entirely). Put /usr/ccs/bin in your path. And if
you want to be really standard (XPG/SUS), put
/usr/xpg6/bin:/usr/xpg4/bin in your PATH.

A Bientot
Paul
--
Paul Floyd http://paulf.free.fr

0 new messages