问题
So I recompiled a perfectly fine and working project and suddenly all I get is this linker error:
[ilink32 Error] Fatal: Unable to open file 'DATA.BIND.OBJECTSCOPE.OBJ'
The project is a C++ console application with VCL enabled and I have no idea where the DATA.BIND.OBJECTSCOPE.OBJ comes from.
These are the headers I'm using.
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <vector>
#include <vcl.h>
#include <System.hpp>
#include <System.IOUtils.hpp>
#include <System.Zip.hpp>
#include <System.Classes.hpp>
#include <System.IniFiles.hpp>
I tried to do a complete disc clean, removing all temp files etc... No change... This project was compiling fine yesterday.
回答1:
In my experience, this is caused when a library or control that your project uses decides that it needs DATA.BIND.OBJECTSCOPE (e.g., due to a uses clause in Delphi code or a #pragma link in C++Builder code).
A quick but not at all elegant fix:
- Determine which 
.libfile includes this.objfile. (You can do this by going to the libraries directories for RAD Studio and for any third-party libraries you're using and grepping for the.objfilename, or the TLIB command can list the.objfiles in a.lib.) - Edit your 
.cbprojfile in a text editor to add that library to theLinkPackageStaticsandAllPackageLibssections. 
Depending on your project settings (whether or not you're using runtime packages, whether you're linking statically or dynamically), you may be able to go under Project Options, Packages and under Project Options, Packages, Runtime Packages and edit package lists there, instead of editing the .cbproj directly.
回答2:
I found this solution on Embarcadero bug tracker:
Add the followind to one of your source files
#if defined(_WIN32) && !defined(_WIN64)
#pragma link "Data.Bind.ObjectScope.obj"
#endif
The original solution ha been provided here. https://plus.google.com/103589122222763968447/posts/gSwPfUZLPEH
回答3:
I'll add this here if someone else stumbles upon this highly frustrating issue.
I had this exact problem. It occurred when I included REST.Client.hpp in an Embarcadero RAD Studio project which uses C++ Builder. After some wasted hours I ended up dropping the REST Client component onto a GUI designer form. Boom. Works. It was this site that lead me onto the right track.
It says that #pragma link entries are included in source files automatically when you put a component onto a form.
来源:https://stackoverflow.com/questions/28990194/strange-c-builder-linker-error-data-bind-objectscope-obj