Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6689703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:33:01+00:00 2026-05-26T05:33:01+00:00

I am getting linking errors error LNK2028: unresolved token (0A000018) extern C void __clrcall

  • 0

I am getting linking errors

error LNK2028: unresolved token (0A000018) “extern “C” void __clrcall MyCFunction(struct ud *)” (?MyCFunction@@$$J0YMXPAUud@@@Z) referenced in function “public: __clrcall MyCPPProj::MyClass::MyClass

error LNK2019: unresolved external symbol “extern “C” void __clrcall MyCFunction(struct ud *)” (?MyCFunction@@$$J0YMXPAUud@@@Z) referenced in function “public: __clrcall MyCPPProj::MyClass::MyClass

When I try to call functions in my C static library from a C++ class.

Here is how my library’s header begins:

#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include "types.h"
extern void MyCFunction(struct myCStruct*);

Here is a snippet from the header’s implementation:

extern void
MyCFunction(struct myCStruct* cStrInst)
{
    //Do stuff
}

and this is how I am calling it:

#include "MyCLib.h"
MyClass::MyClass() {
    myCStruct myCObj;
    MyCFunction(&myCObj);
    //More to follow...
}

Any one know where I am going wrong? All the advice I can find seems to have already been implemented, i.e. declaring whole header with extern "C" { wrapper (http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html).

EDIT
I’ve tried making the C library more C++ compliant and included it as C++ and C with the same result: LNK2028 and LNK2019 linker errors. I made it a static library because projects need to have a type and I needed to see it compile in isolation before adding it to my solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:33:02+00:00Added an answer on May 26, 2026 at 5:33 am

    As a preliminary, though correct answer, I have found that adding a Form to the original native C library project (in its own solution – VS mutters a warning about converting the project which I just accepted), and ensuring all files are C++ (change suffix and explicitly casting) allows me to link to and call the function that was previously breaking. What’s one more refactorisation?

    So I’m happy with getting that first function to work. Onwards and upwards!

    UPDATE Somewhere along the lines I was getting LNK2001 and LNK2019 errors again. This time relating to third party code. The fix was suprisingly easy (duplicate declaration replaced #pragma once #include) and prolly not picked up by the original compiler.

    It all works great together now. Though I had an alternative LGPL / BSD solution if I couldn’t use my original source 😀

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Linking... Directory.obj : error LNK2019: unresolved external symbol public: void __thiscall indexList<class entry,100>::read(class std::basic_istream<char,struct
I'm getting some really wierd linking errors from a class I wrote. I am
I am getting this error after adding the libxml2.2.dylib file Linking /Users/Biranchi/Desktop/Funmovies TabBarController/build/Debug-iphonesimulator/funmovies.app/funmovies (1
I am getting the following error from C++ Builder 2009's linker Unresolved external '__fastcall
I am getting some linking errors during the compilation of C project in Microsoft
I've been getting some strange linking errors in XCode. I understand more or less
I'm getting these errors while linking, both messages have to do with the same
So, I'm a bit confused on this error that I'm getting while compiling/linking a
I'm using visual studio 2003 and I'm getting the following linking error in my
I am getting a bunch of linking errors while trying to link the release

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.