question

Upvotes
Accepted
2 1 0 4

RFA8 C++ Linker Error

I am creating a Win32 console application which references the RFA8 C++ static library in Visual Studio 2015. However, I get the following linker errors when I try to build my project. I have attached a copy of my project and source code. Is there some linker setting that I am missing?

If you want to compile this yourself, please take note of the location of the header and lib files. I believe my Additional Include Directory setting is correct because the compiler manages to find my #include RFA files. I am less certain about the Additional Include Directory setting (although that is the location of the libRFA8_140_x64.lib file on my machine).

I have gone through the build configuration of the Consumer example program (which I can build correctly on my machine), and I cannot find what my own project gets wrong...rfaproxy2017.zip Any help is appreciated.

Linker Errors:

1>  stdafx.cpp
1>  RfaProxy2017.cpp
1>stdafx.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl rfa::common::RFA_String::RFA_String(char const *,int,bool)" (__imp_??0RFA_String@common@rfa@@QEAA@PEBDH_N@Z) referenced in function "void __cdecl rfa::rdm::`dynamic initializer for 'ENAME_ACCEPTING_CONS_STATUS''(void)" (??__EENAME_ACCEPTING_CONS_STATUS@rdm@rfa@@YAXXZ)
1>stdafx.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl rfa::common::RFA_String::~RFA_String(void)" (__imp_??1RFA_String@common@rfa@@QEAA@XZ) referenced in function "void __cdecl rfa::rdm::`dynamic atexit destructor for 'ENAME_ACCEPTING_CONS_STATUS''(void)" (??__FENAME_ACCEPTING_CONS_STATUS@rdm@rfa@@YAXXZ)
treprfarfa-apic++
rfaproxy2017.zip (19.3 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
17.9k 82 39 63

Hi @ngm,

I had a look at your package and you are missing the preprocessor flag: __RFA_STATIC_BUILD__. I included this setting within your project and it linked and ran ok.

I would encourage you to refer to the compiler settings page within the Developer Community. It contains the require settings but more importantly, it also contains template project files you can download. This will definitely save you time when building your projects - especially for multiple build types.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
2 1 0 4

Hi Nick,

This is great! Thank you!!

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.