-   Programming (
-   -   The error compile C/C++ in linux (but it does compile on Win) (

hikaru1505 12-29-2010 11:38 PM

The error compile C/C++ in linux (but it does compile on Win)
Dear all
I have a piece of code that is part of a larger project, and it compiles in Windows just fine (using SSH Secure Shell Client). When I try to compile it in linux, it doesn't work. I get "[duong@node0 3D]$ icc -o DEM DEMsim_3D.cpp -lm -O2

DEMsim_3D.cpp:(.text+0xdb11): undefined reference to `operator*(double, Vector3D)'
DEMsim_3D.cpp:(.text+0xdb2d): undefined reference to `Vector3D::operator+=(Vector3D)'
........ ''

In the universities linux environment (either CentOS or RedHat--going to command line from SSH Secure File Transfer Client), it compiles fine, but segment faults when the sort is trying to run (once again back to the overload operator of the Point and Vector class).

I have my source files for the Point nad Vector class here (
Anyone have any idea?

Thank you very much!

GrapefruiTgirl 12-30-2010 08:57 AM

Moved: This thread is more suitable in "Programming", and has been moved accordingly to help your question get the exposure it deserves.

Also please note that adding your email address to the end of your post (I have removed it), is not a good idea for at least two reasons:

1) it looks like you expect people to personally email you with a solution; LQ doesn't work like that.
2) opens you up to potential torrents of SPAM email to your inbox; not good!

Kind regards, and good luck with this.

Nylex 12-30-2010 09:11 AM

Those are linker errors. You need to link the libraries/object files that contain those functions.

All times are GMT -5. The time now is 02:14 AM.