Jump to content
Alexander I.

[Solved] Can't build project using TJson

Recommended Posts

Posted (edited)

Here is the code:

#include <REST.Json.hpp>
...
TJson* formatter=new TJson();

Compilation successful, but linker says following:

[ilink32 Error] Error: Unresolved external 'Rest::Json::TJson::' referenced from C:\USERS\ISKOR\DESKTOP\TJSONTEST\WIN32\DEBUG\UNIT1.OBJ

 

How can that be?

 

I use C++ Builder 10.1 Community Edition.

Edited by Alexander I.

Share this post


Link to post
55 minutes ago, Alexander I. said:

Compilation successful, but linker says following:

[ilink32 Error] Error: Unresolved external 'Rest::Json::TJson::' referenced from C:\USERS\ISKOR\DESKTOP\TJSONTEST\WIN32\DEBUG\UNIT1.OBJ

 

How can that be?

You are not linking to the BPL library that implements TJson.  Try adding a reference to the RESTComponents.bpi file to your project.

Share this post


Link to post
9 hours ago, Remy Lebeau said:

You are not linking to the BPL library that implements TJson.  Try adding a reference to the RESTComponents.bpi file to your project.

That worked! Thank you!

But why it does not work by default, that is the question.

Share this post


Link to post
Posted (edited)
13 hours ago, Alexander I. said:

But why it does not work by default, that is the question.

Why would it?  If all you did was add an #include statement to your code, the IDE is not smart enough to know which library to automatically add to the project to make the code in that header file link correctly.  It doesn't even know what code is in that header file until the compiler is invoked, and by then it is too late.  The IDE can do automatic linkage of libraries only for components that are dropped on a Form/Frame/DataModule in the Designer.  Did you do that for the REST components?  I'm guessing no.  But this issue is not specific to just REST, it applies to any library.  For non-designtime code, you are responsible for setting up your project with any necessary library references as needed.

Edited by Remy Lebeau

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×