From: Riddler02 AT aol DOT com Message-ID: <7a.178f849.25d6f9ab@aol.com> Date: Sat, 12 Feb 2000 13:00:11 EST Subject: Linking to my library STILL sucks! To: djgpp AT delorie DOT com MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: AOL 4.0 for Windows 95 sub 38 Reply-To: djgpp AT delorie DOT com itmiller AT dera DOT gov DOT uk (Ian Miller) writes: > Have you tried writing a *really* simple library? Containing one class with > just a constructor and destructor that both just write to cout, say. Then > you could try to link a tiny program to that library and at least confirm > that you can do this at all. I just tried this out. here's what it looks like: LIBTEST.A consists of 2 files, a header and a source: //TEST.H class test_class { void test_message(void); }; //TEST.CPP #include #include "test.h" void test_class::test_message(void) { cout << "My library doesn't work!"; } This library builds correctly. Now here is my simple library-testing program ("test" is checked off in RHIDE's library menu): //TESTPROG.CPP #include #include "test.h" void main() { test_class test_object; test_object.test_message(); } This program compiles correctly with the command: gcc -g -c testprog.cpp -o testprog.o And LINKS correctly too with the command: gcc -o testprog.exe testprog.o -ltest -lstdcx (note that "-lstdcx" SHOULD say "-lstdcxx", but I changed the name to be 1 character shorter to deal with the long file name problem - it works fine now though) So now I know that a simple library will work - there must be something wrong with my code. nick AT arcticmail DOT com suggested that the order in which the libraries are linked is important - object files, user libraries, then the standard libraries, but I checked and this is the order I do it in. Anybody have any suggestions on where to start looking in my code? :) thanx again for all your support -Kevin