Borland C++ Builder 4 [Linker Error] Unresolved external - linker

I'm trying to compile an old project in Borland C++ Builder 4. I have a working exe and the source files for that, therefore someone must have managed to compile it earlier. However, when I open the project, check if the project hs all the necessary files in the resources and try to compile it, I keep getting the following linker error:
[Linker Error] Unresolved external '_fastcall TMapperForm::Button1Click(System::TObject*)' referenced from ...\Unit1.obj
I can see that it cannot find an object in the library but I am not sure how to resolve it, because the obj file with the same name as the main cpp file is in the same file as the other files of the project and seems fine.
I have looked through the answers provided here for similar linker errors but none of what these have suggested worked for me. I have already tried the following:
Adding the .obj file to the Project Resources.
Trying to add pragma lines manually such as #pragma link (Unit1.obj)
Making sure that in Project>Options>Directories the right Include and Library paths were selected.
Checking if all the packages have been added.
None of this seems to work. I am fairly new to C++ and C++ Builder, so I am hoping that it is something trivial.
Has anybody seen this particular error?

The error was caused by a missing handler or more precisely a handler containing nothing.
While the handler for the button contained nothing, the TMapperForm class still included the definitions for an extra button named Button1 but it was not used. Commenting out the method and the declaration in the TMapperForm class (in the header file for Unit1) along with the handler in the C++ file resolved the problem.

Related

Why can't I call this C function from my Swift code?

I am trying to call this C library from my Swift code. I dragged the source files into my project and created a module.map file and added the directory containing the module map to Build Settings->Search Paths->Import Paths.
It seems to work. I can import the library and the name even shows up in autocomplete:
And I can access functions from the library and again autocomplete knows they are there:
But when I build, I get this error:
This name, "_mtex2MML_parse", is the same as the name of C function I'm trying to call except prefixed with an underscore.
I've gotten this same error before in similar circumstances trying to get cmark to work, but fixed it there by making sure that the .c file was included in the Target Membership, and then everything was fine. When I fiddled with doing that in this project, I've not had any luck. And in that case, autocomplete didn't even know about the function.
I've tried cleaning, deleting derived data, quitting Xcode, restarting computer, etc. I've tried on Xcode 8.3.3 Swift 3.1 and on Xcode 9b4, Swift 4.0. I'm on macOS 10.12.6. There is no other thing in the project besides this.
Can anyone offer any advice on how to proceed? Thanks.

Nested static libraries in Visual Studio?

I have a static library for a Vector implementation in C.
I am now making a new library that is going to rely on the Vector in order to function property. This new library is called String. Both are static libraries created in Visual Studio with their own .c and .h files.
I do the following just like I would when referencing any other static library
Create new static library. Create .c and .h files in it.
project -> properties -> C/C++ -> Additional include directories and set as the folder that contains the .c and .h files for my Vector
File -> Add -> Existing Project and set the .vcxproj file of the Vector project.
In my solution explorer, I went under my String solution and right clicked References and then check-marked the Vector box that shows up.
At this point, my String is now correctly able to see Vector.
The problem
When I open a new project, repeat those same steps except with String as the target library, I get the following error:
Severity Code Description Project File Line Suppression State
Error MSB8006 The Platform for project 'C-DataStructuresLib.vcxproj' is invalid. Platform='HPD'. This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Platform. CStringLib C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.InvalidPlatform.Targets 21
The line:
This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Platform
Is correct because that's exactly what I'm trying to do. How can this be fixed?
Are you trying to compile as 64-bit project?
Check in the property page the section: Linker -> Advanced -> Target Machine

Code composer inline function linker error

I am working with Code Composer Studio and I need to inline some functions.
So I put them in a header file (or in .inl file referred by a header, both ways) and try to build my project.
The problem comes when I increase the optimization level. The project builds successfully under no optimization, (off or none) but the linker fails to link them and returns:
error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking;
Has anyone encountered similar issues?
Is is because am not utilizing some kind of flag in the compiler options?
Please check this link http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/249183.aspx .
When SW_ROOT was correctly defined, this issue was resolved.

LNK2020 & LNK1120 errors in old class in old working project since other project added that includes same class

I am getting unexpected linker errors after refactoring my solution from 1 to 3 projects. In this first instance I get two unresolved tokens, like
error LNK2020: unresolved token (0600000C) Mynamespace.MyClass::unresolvedStaticFunc
error LNK2020: unresolved token (0600000C) Mynamespace.MyClass::unresolvedOtherStaticFunc
fatal error LNK1120: 2 unresolved externals
I have not touched this class in my refactoring. Both methods are declared static in the header but not the body (cpp file).
I've rechecked my errors and the new project is compiling fine but forcing the old one to break on linking.
I think I need to add files to my new projects but they seem nicely separated into their own folders now. Another project for the shared class perhaps? I am adding what I thought a simple feature and my project count has already tripled.
You should not be #includeing header files containing managed types across multiple projects. Instead, in the new project, add an assembly reference to the old project; this way, the type information will be gathered from the .NET metadata embedded into the old project's assembly.

How can I import compiled C++ libraries into an Objective-C++ project in Xcode 4?

I'm trying to use the SkypeKit SDK to create an Objective-C++ project using Xcode 4. I have two compiled libraries from SkypeKit, libskypekit_cyassl_lib.a and libskypekit_cppwrapper_2_lib.a, which I need to be able to use so as to access the Skype API.
I've added in both .a files under 'Linked Frameworks and Libraries' and added -all_load -ObjC -lstdc++ to the 'Other Linker Flags', and that builds okay, but as soon as I try to use any of the methods in those libraries, building fails.
Any help would be greatly appreciated, thank you!
You can call C++ code from Objective-C++, which means that your files should have the .mm extension instead of .m
I assume that this could be the issue, but since you did not specify the errors you get it is just a guess. Specifically, if you call C++ code from a .m file you get compilation errors.
Another possible cause is forgetting to import the header files of the library. For the import to be successful, you also have to add the directory where the headers are to your project "header search path".
If this does not help, please post the error message.

Resources