RadeonRays_SDK icon indicating copy to clipboard operation
RadeonRays_SDK copied to clipboard

Fails to link to RadeonRays as a static library

Open norsetto opened this issue 6 years ago • 1 comments

If I build radeonrays as a static library and then try to link another program to it, on windows linking fails for all static methods with a message like:

Error LNK2019 unresolved external symbol "__declspec(dllimport) public: static void __cdecl RadeonRays::IntersectionApi::SetPlatform(enum RadeonRays::DeviceInfo::Platform)" (_imp?SetPlatform@IntersectionApi@RadeonRays@@SAXW4Platform@DeviceInfo@2@@Z)

I believe this is due to radeon_rays.h using the macro RR_STATIC_LIBRARY which in turn define RRAPI as __declspec(dllimport). The easy solution would be to add a #define RR_STATIC_LIBRARY true before including said header in the application.

Is this an intended behavior? If so, should this be somehow documented (can't find anything in README.md )?

norsetto avatar Mar 25 '18 08:03 norsetto

Yes, this define is needed for static library, but it should be automatically added if you use cmake and just link with RadeonRays target. If you use VS project you can simply add this as global definition instead of adding before header include.

Kvalme avatar Mar 26 '18 07:03 Kvalme