Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Mixing classic and clang: linker error with map



Permlink Replies: 2 - Last Post: Feb 28, 2017 5:33 AM Last Post By: Gary Pickrell Threads: [ Previous | Next ]
Gary Pickrell

Posts: 4
Registered: 1/28/04
Mixing classic and clang: linker error with map
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 25, 2017 12:33 PM
I have a VCL project in using the classic compiler. I want to use c+11, so I have created a static library using clang. It worked until I returned a map, then I started getting linker errors.

Library code (clang)
 
std::map<std::string, std::string> test11() {
std::map<std::string, std::string> Ret;
return Ret;
}


Calling code (classic)
 
std::map<std::string, std::string> Result;
Result = test11();


Here are the errors it gives

[ilink32 Error] Error: Unresolved external 'std::_Xbad_alloc()' referenced from C:\PATTERN\WINDOWSPROJECTS\OUTPUT\SHAREDLIB.LIB|SharedLib
[ilink32 Error] Error: Unresolved external '___seh_personality_v0' referenced from C:\PATTERN\WINDOWSPROJECTS\OUTPUT\SHAREDLIB.LIB|SharedLib
[ilink32 Error] Error: Unresolved external '__Unwind_SjLj_Register' referenced from C:\PATTERN\WINDOWSPROJECTS\OUTPUT\SHAREDLIB.LIB|SharedLib
[ilink32 Error] Error: Unresolved external '___cxa_begin_catch' referenced from C:\PATTERN\WINDOWSPROJECTS\OUTPUT\SHAREDLIB.LIB|SharedLib
[ilink32 Error] Error: Unresolved external '___cxa_rethrow' referenced from C:\PATTERN\WINDOWSPROJECTS\OUTPUT\SHAREDLIB.LIB|SharedLib
[ilink32 Error] Error: Unresolved external '___cxa_end_catch' referenced from C:\PATTERN\WINDOWSPROJECTS\OUTPUT\SHAREDLIB.LIB|SharedLib
[ilink32 Error] Error: Unresolved external '__Unwind_SjLj_Unregister' referenced from C:\PATTERN\WINDOWSPROJECTS\OUTPUT\SHAREDLIB.LIB|SharedLib
[ilink32 Error] Error: Unresolved external '__Unwind_Resume' referenced from C:\PATTERN\WINDOWSPROJECTS\OUTPUT\SHAREDLIB.LIB|SharedLib
[ilink32 Error] Error: Unable to perform link

I am using C++ Builder Seattle.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Mixing classic and clang: linker error with map
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 26, 2017 3:36 PM   in response to: Gary Pickrell in response to: Gary Pickrell
Gary wrote:

I have a VCL project in using the classic compiler. I want to use
c+11, so I have created a static library using clang. It worked
until I returned a map, then I started getting linker errors.

Static libraries are compiler-specific. You cannot create a static lib in
the classic compiler and then use it in the clang compiler, and vice versa.

--
Remy Lebeau (TeamB)
Gary Pickrell

Posts: 4
Registered: 1/28/04
Re: Mixing classic and clang: linker error with map
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 28, 2017 5:33 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Gary wrote:

Static libraries are compiler-specific. You cannot create a static lib in
the classic compiler and then use it in the clang compiler, and vice versa.

--
Remy Lebeau (TeamB)

Thanks! I will try it in a dll.

Gary
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02