This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

library compilation undefined reference to extern function


Hi,

I am compiling a huge library, which is written and compiled under Ubuntu, I have fixed some problems to get it compiled in cygwin.
The main() function is inside library. I stopped in some point which goes different in cygwin.
I have some functions which are declared as - extern void func(void);   Linker gives error - undefined reference to `func()'

then I tried with this to compare differences.. 

#include <iostream>
using namespace std;
extern void foo(void);
int main()
{
        cout<<" Print ";
        foo();
        return 0;
}

a very simple example I can compile in linux (Ubuntu) without any problem, but in cygwin it goes with linker errors - undefined reference, in both systems I use  

$ gcc -c -Wall -fpic filename.cc
$ gcc -shared -o libfoo.so filename.o

commands.
I could not find solution of this anywhere.

Thank you, 
Best regards, Anushavan

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]