By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,513 Members | 1,604 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,513 IT Pros & Developers. It's quick & easy.

icc compiler, object file problem

P: n/a
Hi all,

I am current engage in a project that require me to create object
files. However I am struck in compiling all the object files
together. I tend to get lots of undefined reference some of which is
from iostream and others are from "new" and "delete"

This is what i did,
test: myprog.o myprog2.o myprog3.o
icc myprog.o myprog2.o myprog3.o -o myprog -lbz2 -lcrytopp -openmp

myprog.o: myprog.cpp
icc -DINTEL -march=i686 -c myprog.cpp -lbz2 -lcrytopp -openmp

myprog2.o: myprog2.c
icc -DINTEL -march=i686 -c myprog2.c

myprog3.o myprog3.c
icc -DINTEL -march=i686 -c myprog3.c

some Errors,

undefined reference to std::istream::seekg...
undefined reference to std::istream::tellg
undefined reference to operator new
undefined reference to operator delete
and many more undefined reference

Anyone know how to solve it. By the way I can't use gcc because I am
required to use openmp.
Thanks

P.S. I am apologize if I place this post in the wrong group.

May 28 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 28 Maj, 04:25, eva2002 <Eva2...@gmail.comwrote:
Hi all,

I am current engage in a project that require me to create object
files. However I am struck in compiling all the object files
together. I tend to get lots of undefined reference some of which is
from iostream and others are from "new" and "delete"

This is what i did,
test: myprog.o myprog2.o myprog3.o
icc myprog.o myprog2.o myprog3.o -o myprog -lbz2 -lcrytopp -openmp

myprog.o: myprog.cpp
icc -DINTEL -march=i686 -c myprog.cpp -lbz2 -lcrytopp -openmp

myprog2.o: myprog2.c
icc -DINTEL -march=i686 -c myprog2.c

myprog3.o myprog3.c
icc -DINTEL -march=i686 -c myprog3.c

some Errors,

undefined reference to std::istream::seekg...
undefined reference to std::istream::tellg
undefined reference to operator new
undefined reference to operator delete
and many more undefined reference

Anyone know how to solve it. By the way I can't use gcc because I am
required to use openmp.
Thanks

P.S. I am apologize if I place this post in the wrong group.
Yes, this is the wrong group, next time see if there is one for your
compiler or search around the Intel support pages.

As to your problem, it seems like you don't link against the standard C
++ library, either you have to specify a C++ library implementation
(just like you did with -lbz2 etc.) or you have to specify that you
are compiling C++ code and the compiler will take care of the rest.
Searching through the compiler documentation should give you an
answer.

--
Erik Wikström

May 28 '07 #2

P: n/a
On Sun, 27 May 2007 19:25:33 -0700, eva2002 wrote:
Hi all,

I am current engage in a project that require me to create object files.
However I am struck in compiling all the object files together. I tend
to get lots of undefined reference some of which is from iostream and
others are from "new" and "delete"
I think the Intel C++ compiler is called `icpc' - `icc' is the C
compiler. So compile your C modules with `icc' and your C++ modules with
`icpc' - and link with `icpc'.
>
This is what i did,
test: myprog.o myprog2.o myprog3.o
icc myprog.o myprog2.o myprog3.o -o myprog -lbz2 -lcrytopp -openmp
icpc myprog.o myprog2.o myprog3.o -o myprog -lbz2 -lcrytopp -openmp

(link using C++ compiler)
myprog.o: myprog.cpp
icc -DINTEL -march=i686 -c myprog.cpp -lbz2 -lcrytopp -openmp
icpc -DINTEL -march=i686 -c myprog.cpp -openmp

(compile using C++ compiler... and I don't think you need the link flags here)
myprog2.o: myprog2.c
icc -DINTEL -march=i686 -c myprog2.c

myprog3.o myprog3.c
icc -DINTEL -march=i686 -c myprog3.c

some Errors,

undefined reference to std::istream::seekg... undefined reference to
std::istream::tellg undefined reference to operator new
undefined reference to operator delete and many more undefined reference

Anyone know how to solve it. By the way I can't use gcc because I am
required to use openmp.
Thanks

P.S. I am apologize if I place this post in the wrong group.
Yes you probably did, but I'm feeling kind ;-)

--
Lionel B
May 29 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.