compilation error in gcc


 
Thread Tools Search this Thread
Top Forums Programming compilation error in gcc
# 1  
Old 01-18-2002
Question 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:Smilieperator<<(ostream &(*)(ostream &))/var/tmp/ccK1IfM6.o
endl(ostream &) /var/tmp/ccK1IfM6.o
ostream:Smilieperator<<(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
# 2  
Old 01-18-2002
I don't use gcc, but I thought gcc was a c compiler. Your program is in c++.
# 3  
Old 01-18-2002
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.
# 4  
Old 01-21-2002
Thanks

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

ls1429
# 5  
Old 01-22-2002
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.
# 6  
Old 01-22-2002
You have to have download it from gcc.gnu.org. But if you have download the full version g++ is included.
# 7  
Old 01-22-2002
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Gcc compilation problem on AIX 6.1

Hi, I have to compile a program on my server, runs on AIX 6.1. On my test server the compilation is ok (AIX 6.1); but when I try it on production server, I have this gcc prog.c -o prog_out In file included from resmon.c:111: /usr/include/unistd.h:924: error: expected ')' before ' I noticed... (1 Reply)
Discussion started by: tnjulius
1 Replies

2. Programming

Header file compilation using gcc in Sparc Solaris

I am facing problem while migrating the c++ code from Linux to Solaris. In linux the code is absolutly compiled fine with GCC compiler but when i am using the same in Solaris it coomplains bash-3.1$ gcc LibSip.h gcc: Compilation of header file requested The same command is working fine in... (2 Replies)
Discussion started by: mrupesh74
2 Replies

3. Programming

Compilation Error

I am getting the below given errors for the following program though all the variables have been declared and used appropriately. Please Help. The environment is AIX. Error: ------ "gbsizeprofile.c", line 67.4: 1506-275 (S) Unexpected text 'void' encountered. "gbsizeprofile.c", line 67.10:... (2 Replies)
Discussion started by: yschd
2 Replies

4. Solaris

Installing gcc - recieve error message gcc : cannot execute

AIM- Install Oracle 11g on Solaris using VMWare Steps 1.Logged on as root 2.Created subfolders à /usr/local/bin & /usr/local/bin/gcc 3.Downloaded gcc & libiconv & unzipped them on my harddrive & burnt them on CD 4.Copied files from CD to /usr/local/bin/gcc 5.Terminal (root) à pkgadd -d... (8 Replies)
Discussion started by: Ackers
8 Replies

5. Programming

64-Bit gcc Compilation

Hi All I have a question on the compilation Assume i am working on 64 bit Linux OS. i am making shared objects and libraries required for our project. Can i compile 32 bit libraries using gcc of 64 -bit OS? Or Is there any restriction in the 32-bit or 64-bit compilers when trying to... (6 Replies)
Discussion started by: dhanamurthy
6 Replies

6. HP-UX

compilation error

hello everyone, here i am attempting to compile a c++ submodule.OS is HP-UX. here i am getting the following error. ====================================== "Make: Don't know how to make compile. Stop." =================================== could you pls somebody suggest why this error is... (2 Replies)
Discussion started by: mannam srinivas
2 Replies

7. Linux

c++ compilation error

Hello every one, here i am attempting to compile a c++ module using gcc.it is throwing a error . error: ==== > make -S dummyCHARGP /usr/local/bin/gcc -g -DDEBUG -DMAT -I. -I/swtemp/usbs/cc/unix-ce/root/subsys/lib/Linux/ -I/opt/dce/include -I/opt/dce/include/dce ... (12 Replies)
Discussion started by: mannam srinivas
12 Replies

8. Programming

Regarding compilation error.

Hi All, I facing the following compilation error; when I implementing the following logic. ostrstream ostr; ostr << (( scAxsm.getRecord( i ).getField( 2 ).getShort())%12)!=0?(( scAxsm.getRecord( i ).getField( 2 ).getShort())/12+1) : (( scAxsm.getRecord( i ).getField( 2 ).getShort())/12) <<... (1 Reply)
Discussion started by: sweta
1 Replies

9. Solaris

Compilation on SunOs5.7 using gcc 3.3.5

I have the following declaration in file named vx_solaris.h (Path : /usr/share/src/tpkgs/veritas/solaris_sparc/include/sys/fs/vx_solaris.h) typedef (*vx_creatfptr_t)(struct vnode *, char *, struct vattr *, vcexcl_t, int, struct vnode **, vx_cred_t *, int); I include vx_solaris.h in one of... (5 Replies)
Discussion started by: amitc
5 Replies

10. Programming

gcc compilation

how can i do static compilation in gcc my gcc version is # gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/u sr/share/info --enable-shared --enable-threads=posix --disable-checking... (3 Replies)
Discussion started by: collins
3 Replies
Login or Register to Ask a Question