X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,HK_OBFDOM,SPF_PASS,WEIRD_PORT X-Spam-Check-By: sourceware.org Message-ID: From: Peter Mills To: cygwin mailing list Subject: Problems linking--"undefined reference to..." Date: Fri, 29 Jan 2010 20:49:20 -0500 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com I get two rather cryptic errors when I try to compile some of my own softwa= re.=A0 In the first, the software links fine normally, but when I try to add debug information with the -g switch, I get the following=20 error or something similar: $ make g++ -I/home/Petey/include=20 -Wno-deprecated -g=A0 -o model1 model1.cc -L/home/Petey/lib -ldataset-g=20 -lpetey -lsparse-g -lgsl -lgslcblas /tmp/cc5e9G8Z.o: In function=20 `_ZN7datasetD0Ev': /home/Petey/include/simple_temp.h:(.dtors+0x0):=20 undefined reference to `global destructors keyed to x_grid' /home/Petey/lib/libdataset-g.a(simple_temp-g.o): In function `_ZN6simpleIdEeqIdEEiRKS_IT_E': /home/Petey/my_software/datasets/simple_temp.cpp:(.dtors+0x0): undefined reference to `global destructors keyed to=20 _ZN6simpleIfE8set_typeEv' collect2: ld returned 1 exit status make: *** [model1] Error 1 (I create multiple versions of the=20 libraries by appending the optimization flag, e.g. -g, -O2 etc.) The second error, and the simpler-looking of the two, is as follows: g++ -I/home/Petey/include -Wno-deprecated -O2=A0 -o model2 model2.cc=20 traj_int_obj.o tcoord_defs.o -L/home/Petey/lib -ldataset-O2 -lpetey=20 -lsparse-O2 -lgsl -lgslcblas model2.cc: In function `int main(int,=20 char**)': model2.cc:140: warning: converting to `long int' from=20 `double' traj_int_obj.o:traj_int_obj.cc:(.text+0x12): undefined=20 reference to `_mcount' traj_int_obj.o:traj_int_obj.cc:(.text+0x6f):=20 undefined reference to `_mcount' traj_int_obj.o:traj_int_obj.cc:(.text+0x165): undefined reference to `_mcount' traj_int_obj.o:traj_int_obj.cc:(.text+0x212): undefined reference to `_mcount' traj_int_obj.o:traj_int_obj.cc:(.text+0x382): undefined reference to `_mcount' traj_int_obj.o:traj_int_obj.cc:(.text+0x702): more undefined references to `_mcount' follow There is no variable=20 or function called "mcount" in traj_int_obj.cc.=A0 The only external=20 header I use is stdio.h so it must be somehow connected. Any help anyone could offer would be greatly appreciated. Regards, Peter Peter Mills Maverick scientist and software developer http://sourceforge.net/users/peteysoft/ -Innovative, original and efficient numerical algorithms http://libagf.sourceforge.net/ -Fast, simple and accurate statistical classification. =20=09=09=20=09=20=20=20=09=09=20=20 _________________________________________________________________ Reinvent how you stay in touch with the new Windows Live Messenger. http://go.microsoft.com/?linkid=3D9706116 -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple