1754043 Members
3236 Online
108811 Solutions
New Discussion юеВ

C compiler error

 
SOLVED
Go to solution
mark.M
Frequent Advisor

C compiler error

HP[/c]# cat test.c
#include
main(int argc, char **argv)
{
printf("Hello World\n");
}

HP[/c]#
HP[/c]# cc -o test test.cc
/usr/ccs/bin/ld: Can't open test.cc
/usr/ccs/bin/ld: Not found Directory and file
HP[/c]# ll
Total 80 Block
-rwxrwxrwx 1 root sys 20480 11 21 15:06 a.out
-rwxrwxrwx 1 root sys 85 11 21 12:39 test.c
HP[/c]# cc test.c
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (test.o) was detected. The linked output may not run on a PA
1.x system.
HP[/c]#
HP[/c]# cc -Wl,+vnocompatwarnings test.c
HP[/c]# ll
Total 80 Block.
-rwxrwxrwx 1 root sys 20480 11 21 15:08 a.out
-rwxrwxrwx 1 root sys 85 11 21 12:39 test.c
HP[/c]#
6 REPLIES 6
RAC_1
Honored Contributor

Re: C compiler error

Not into coding. But going by the warning message it seems that you are compiling onto 64 bit platform and cc is telling that thise code will not run on PA1.0-32 bits platforms.

May be you need +PORTABLE or some similar option.
There is no substitute to HARDWORK
mark.M
Frequent Advisor

Re: C compiler error

i'm used 64bit(rp4440,11v1) machine.
aC++ installed.
no create object file. why???
RAC_1
Honored Contributor

Re: C compiler error

I think you need to understand the message. If you plan to run code on this machine only, then go ahead. If you plan to run code on 32 and 64 bit, then you need to resolve this.
There is no substitute to HARDWORK
MarkSyder
Honored Contributor

Re: C compiler error

It seems to be looking for a file called test.cc and your file is called test.c

I've never used cc so I don't know if it differs from gcc, but what I do is this:

gcc test.c -o test.cc

where test.c is the existing file and test.cc is the output (compiled) file.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Senthil Prabu.S_1
Trusted Contributor

Re: C compiler error

Hi,
this command will help U

#cc -o test test.c
One man's "magic" is another man's engineering. "Supernatural" is a null word.
Sandman!
Honored Contributor
Solution

Re: C compiler error

Mark,

Initially the name of the source file supplied was incorrect "test.cc" instead of "test.c" and hence the reason why cc couldn't find it. Afterwards a correct source file was supplied and the C compiler did create an executable "a.out" which is the name of the default executable created when no output file is supplied explicitly with the "-o" switch as:

# cc -o test test.cc

The compiler warned about the PA-RISC architecture version since the created executable wouldn't run on anything less than a PA-RISC2.0 machine, however you need not concern yourself with it. IMHO...your command for generating the executable should be...

HP[/c]# cc -Wl,+vnocompatwarnings test.c -o test

...or run the default executable in your working directory "a.out" as follows:

HP[/c]# ./a.out

hope it helps!!!