compilation error in gcc

Hi,

Should be too simple...

I wrote a sample c++ program like

#include <iostream.h>
int main()
{$
int ab=455;
cout << ab << endl;
return 1;
}

I am getting error like

$ gcc u1.cpp
Undefined first referenced
symbol in file
cout /var/tmp/ccK1IfM6.o
ostream::operator<<(ostream &(*)(ostream &))/var/tmp/ccK1IfM6.o
endl(ostream &) /var/tmp/ccK1IfM6.o
ostream::operator<<(int) /var/tmp/ccK1IfM6.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status

Not able to figure out what the problem is.

THanks
ls1429

I don't use gcc, but I thought gcc was a c compiler. Your program is in c++.

Heh, I missed that completely, but yes, that may very well be the problem, as even the gcc man page say gcc assumes files are C code, and g++ assumes files are C++ code.

g++ is what you would need for this.

Thanks

Is there any idea how to identify where the compiler is ?
I mean the compiler's path

ls1429

It should be in the same place as gcc... if not, try whereis g++, and if all else fails, try find / -type f -name g++ -print 2>/dev/null... It'll be slow, but hopefully it's installed.

You have to have download it from gcc.gnu.org. But if you have download the full version g++ is included.

Sorry if I have misled the question.

What I intended to ask is ...
I just want to know where the compiler will be available generally & is there any place to search in specific, across machines for any compilers

Thanks

Well, to the best of my knowledge, there is no real standard in placing programs. For example, I have seen gcc in /usr/bin, /opt/gcc/bin, /usr/contrib/bin, /usr/gnu/bin...

It's just where the admin / distributers want it...

I am getting error like

root@kplapp2u # ./gcc /export/home/kplus/K2W/K2W.c
Undefined first referenced
symbol in file
MQPUT /var/tmp//ccC2ryxn.o
MQCLOSE /var/tmp//ccC2ryxn.o
ICC_main_loop /var/tmp//ccC2ryxn.o
MQCONN /var/tmp//ccC2ryxn.o
MQDISC /var/tmp//ccC2ryxn.o
MQOPEN /var/tmp//ccC2ryxn.o
ICC_DataMsg_Display_msg /var/tmp//ccC2ryxn.o
ICC_create /var/tmp//ccC2ryxn.o
ICC_DataMsg_Buffer_get /var/tmp//ccC2ryxn.o
ICC_DataMsg_Integer_set /var/tmp//ccC2ryxn.o
ICC_DataMsg_init /var/tmp//ccC2ryxn.o
ICC_DataMsg_setf /var/tmp//ccC2ryxn.o
ICC_DataMsg_get /var/tmp//ccC2ryxn.o
ICC_DataMsg_set /var/tmp//ccC2ryxn.o
ICC_DataMsg_send_to_server /var/tmp//ccC2ryxn.o
ld: fatal: Symbol referencing errors.

Thanks
UKT

Those are linker errors.

I assume you are linking icc code. Let's assume the run time library for icc is
/usr/lib/libicc.so ( I don't know the correct name...)

Then

# ./gcc /export/home/kplus/K2W/K2W.c -L licc -o /export/home/kplus/K2W/K2W

Also, do not run everyday tasks logged on as root. It's a terrible idea.