help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Linker error with mit gc++ 3.2 (works with VC++ 7.1)


From: kaspar
Subject: Linker error with mit gc++ 3.2 (works with VC++ 7.1)
Date: 29 Apr 2004 06:21:47 -0700

Hello,

first of all: My C/C++ experience is limited, so my problem might be
trivial for you...

I am currently writing a C++ project which shall include some legacy C
code. The C functions shall be called from within a member function.
In the header fiel of the corresponding object I put the 'extern "C"'
stuff to include the C header files (*.h). The C source files (*.c)
are compiled with g++.

When compiling the whole project with g++ 3.2, I get the following
linker errors:

E:\oop\goose\goose.obj(.text+0x872):goose.cpp: undefined reference to
`std::__default_alloc_template<true, 0>::deallocate(void*, unsigned)'
E:\oop\goose\goose.obj(.text+0x889):goose.cpp: undefined reference to
`std::__default_alloc_template<true, 0>::deallocate(void*, unsigned)'
E:\oop\goose\goose.obj(.text+0x89d):goose.cpp: undefined reference to
`std::__default_alloc_template<true, 0>::deallocate(void*, unsigned)'
E:\oop\goose\goose.obj(.text+0x8b4):goose.cpp: undefined reference to
`std::__default_alloc_template<true, 0>::deallocate(void*, unsigned)'
E:\oop\goose\goose.obj(.text+0x8cb):goose.cpp: undefined reference to
`std::__default_alloc_template<true, 0>::deallocate(void*, unsigned)'
E:\oop\goose\goose.obj(.text+0x8e2):goose.cpp: more undefined
references to `std::__default_alloc_template<true,
0>::deallocate(void*, unsigned)' follow
E:\oop\goose\goose.obj(.text+0x10d0):goose.cpp: undefined reference
to `std::string::_S_empty_rep_storage'
E:\oop\goose\goose.obj(.text+0x10f3):goose.cpp: undefined reference
to `std::string::_S_empty_rep_storage'
E:\oop\goose\goose.obj(.text+0x10fd):goose.cpp: undefined reference
to `std::string::_S_empty_rep_storage'
E:\oop\goose\goose.obj(.text+0x110d):goose.cpp: undefined reference
to `std::string::_S_empty_rep_storage'
...

To me these error messages seem to have something to do with the STL
(which I use in my C++ code). However, compiling/linking the project
*without* the C part works without problems, the code runs nicely. The
strange thing to me is that the C functions don't use the STL at all
(of course), but compiling *with* the C functions gives me STL
errors...?

Compiling and linking the project with MS VC++ 7.1 works fine, even
with the C functions! Even if I turn off all MS compiler extensions it
works - g++ won't.

I use MinGW's g++ 3.2 on a Windows XP machine.

Any ideas why I get these errors?

Kaspar


reply via email to

[Prev in Thread] Current Thread [Next in Thread]