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

  • SEARCH
  • Home
  • 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 3968780
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:53:03+00:00 2026-05-20T03:53:03+00:00

After creating a GUI for my personal little application, I am trying to compile

  • 0

After creating a GUI for my personal little application, I am trying to compile it as a static library to use in another project. The GUI is created and has other tasks performed with it through a managed public ref class that currently only has 5 functions, but will be added to.

This is my header file in the static library that would be included in the other project (well, at least a new one with only the public functions, all the extra stuff would be removed);

#ifndef GUIInterface_H
#define GUIInterface_H
#include 
#include "MainForm.h"

using namespace System;
using namespace System::Threading;

 public ref class GUIInterface
{
private:
    ThreadStart^ GUIThreadDelegate;
    Thread^ GUIThread;
    void GUIThreadFunction()
    {
        ANNGUI::Application::EnableVisualStyles();
        ANNGUI::Application::Run(gcnew ANNGUI::MainForm());
        return;
    }

public:
    int CreateGUI();

    int DestroyGUI();

    int GetInputData();

    bool CheckNewInput();

    int NetworkState();
};
#endif

This is how it would be accessed from the other project (.exe)

#include "main.h"

int main()
{
    GUIInterface ^GUI = gcnew(GUIInterface);
    GUI->CreateGUI();
    return 0;
}

The main.h just contains the class definitions like the header file shown above, minus the private stuff.

I am using Visual Studio 2010 Express C++. Both projects are compiled with /clr switch. The static library is set as a reference in the .exe project. When I compile the static library as a DLL instead, the program runs perfectly (after I remove the main.h in the application). When it is compiled as a static library I get a LNK2020 Error for each of the functions used to communicate with the GUI.

I linked the .exe with the /VERBOSE option to see the output. The linker looks exactly where the .lib is multiple times, but never says it found it even though it’s looking EXACTLY in the right path and for the right file. Also, if it means anything, my .lib builds fine but gets this as a warning.

.NETFramework,Version=v4.0.AssemblyAttributes.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library

My question is, why is the linker looking in the right place for the .lib, but not seeing it right in front of it’s face? How can I go about fixing this so that I can use my static .lib?

  • 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-20T03:53:03+00:00Added an answer on May 20, 2026 at 3:53 am

    A static .lib is not a valid target option for managed code. There is no implemented mechanism to get the all-important metadata associated with managed types the same kind of treatment as code. It cannot be carved up in bits in pieces and glued together again. The MSFT team probably considered it but got scared away by the massive changes required to the .obj file format. That’s a guess. A good error message would have been nice. That’s a fact.

    You must select a DLL as the target. At runtime, the JIT compiler performs the same function as the linker, it only pulls code from the DLL assembly that is actually used by the client.

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

Sidebar

Related Questions

After creating a Web Application project in VS2010, adding a routing route and run
I am creating a GUI application(wxPython). I need to run another (.exe) application from
I try to run one program in myeclipse where after creating one web project
I'm trying to create a GUI (WPF) Library where each (custom) control basically wraps
I am creating a GUI application using Visual C# 2005 (net framework 2). I
After creating a Azure Project within my silverlight app and adding the existing service
I'm trying to use DDD in my current project (c#, mvc, nhibernate, castle) and
i am creating a java application which is will be GUI for a bash
I'm creating a small tool for data visualization. The GUI is created with Pygtk
After creating a instance of a class, can we invoke the constructor explicitly? For

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.