Re: Trouble with linking C++ DLLs

[email protected] Fri, 4 Nov 2005 08:44:24 -0000 (GMT)
Newsgroups gmane.comp.db.metakit
Message-ID <[email protected]>
Hi Edmond,

> Hi all,
>
> I'm having trouble linking the Metakit library to a simple C++
> program.
<snip>
> I am using MinGW (gcc version 3.4.2) on Windows XP to compile my
> program, which is in a file named main.cpp:
>
<snip>
> When I try to compile using
>
> g++ -I./include -L./bin main.cpp -lmk4vc60 -o mktest.exe
>
> I get the following errors:
>
> C:\...\Temp/cc0Iaaaa.o(.text+0x155):main.cpp: undefined reference to
> `c4_Storage::c4_Storage()'
> C:\...\Temp/cc0Iaaaa.o(.text+0x160):main.cpp: undefined reference to
> `c4_Storage::~c4_Storage()'
> collect2: ld returned 1 exit status
>
> I'm sure that I'm probably overlooking something simple, but I'm
> having a devil of a time figuring out what. Any help will be greatly
> appreciated.

I don't know a huge amount about compiler specifics but what I suspect the
cause of the problem may be trying to link a Visual-C++ DLL that exposes
C++ classes against a MinGW executable - for example, the name mangling
scheme may not match up. Other possible issues at:

http://www.parashift.com/c++-faq-lite/compiler-dependencies.html#faq-38.9

Pure C calls don't have this problem and you can generally mix and match
compilers with a little care and attention.

So I think you would have to rebuild the Metakit DLL with MinGW for this
to work.

Which brings me to a follow-up question which I also need the answer to
because it looks like I need to do it too: Has anyone had experience
compiling Metakit with the MSYS/MinGW toolset? Does it Just Work?

Gareth



_____________________________________________
Metakit mailing list  -  [email protected]
http://www.equi4.com/mailman/listinfo/metakit