Unable to link

Javier Sedano javier.sedano@gmail.com
Wed Aug 12 15:13:00 GMT 2009


Hi friends,

	I've got a extrange problem compiling (linking, actually) under cygwin, 
maybe you can help me. The same procedure works prefectly on Linux, so I 
think I am probably not making some thing that is somehow needed on cygwin.

	I've got a set of .c files to be compiled and merger in a library. So 
far, so good. But, when I compile the test, it complains about missing 
functions. As you can see in the trace below, the function _testBP_1 is 
_not_ in the lib, but I am not using it!. Why is gcc (ld, actually) 
trying to find _testBP_1() when I was using testBP_1().
	As said, exactly the same code, the same Makefile and the same 
procedure works on Linux.

	I've also tried to use "libao-g.a" in the command line, instead of "-L. 
-lao-g", but it fails as well.

	Any idea?


jsedano@ender:~/prj/uc3m/ao/Labs_J/LibAO> make libao-g.a
    [... Many lines removed]
ranlib libao-g.a
jsedano@ender:~/prj/uc3m/ao/Labs_J/LibAO> ls -l libao-g.a
-rw-r--r-- 1 jsedano Ninguno 198714 Aug 12 17:03 libao-g.a
jsedano@ender:~/prj/uc3m/ao/Labs_J/LibAO> gcc -o tests/testBypass 
-Wa,--defsym -Wa,DEBUG=1 -DDEBUG -g -gstabs+ -Wall testBypass.c -L. -lao-g
/cygdrive/c/WINDOWS/TEMP/ccCr93oV.o: In function `main':
/home/jsedano/prj/uc3m/ao/Labs_J/LibAO/testBypass.c:26: undefined 
reference to `_testBP_1'
/home/jsedano/prj/uc3m/ao/Labs_J/LibAO/testBypass.c:26: undefined 
reference to `___aoAsBypassCall'
    [... Many other "undefined references" removed]
collect2: ld returned 1 exit status
jsedano@ender:~/prj/uc3m/ao/Labs_J/LibAO> nm libao-g.a | grep _testBP_1
jsedano@ender:~/prj/uc3m/ao/Labs_J/LibAO> nm libao-g.a | grep testBP_1
00000166 T testBP_1
jsedano@ender:~/prj/uc3m/ao/Labs_J/LibAO> grep testBP_1 testBypass.c
void testBP_1();
     returned = __aoAsBypassCall(&testBP_1, // Function to call
jsedano@ender:~/prj/uc3m/ao/Labs_J/LibAO> gcc -o tests/testBypass 
-Wa,--defsym -Wa,DEBUG=1 -DDEBUG -g -gstabs+ -Wall testBypass.c libao.a
/cygdrive/c/WINDOWS/TEMP/ccbV5cCe.o: In function `main':
/home/jsedano/prj/uc3m/ao/Labs_J/LibAO/testBypass.c:26: undefined 
reference to `_testBP_1'
/home/jsedano/prj/uc3m/ao/Labs_J/LibAO/testBypass.c:26: undefined 
reference to `___aoAsBypassCall'
    [... Many other "undefined references" removed]
collect2: ld returned 1 exit status
jsedano@ender:~/prj/uc3m/ao/Labs_J/LibAO>




-- 
--
Javier Sedano
javier.sedano@gmail.com

--
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



More information about the Cygwin mailing list