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 860851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:52:54+00:00 2026-05-15T08:52:54+00:00

In a c++ project I am working on, I have a simple c++ file

  • 0

In a c++ project I am working on, I have a simple c++ file that needs to run some code at the beginning of the program execution. This file is linked into a static library, which is then linked into the main program.

I have similar code in other files running fine, that looks something like:

bool ____nonexistent_value = executeAction();

However, it does not work inside this file unless I make use of a function implemented in this file. It does work if the library is compiled as a shared library. I’d prefer to link this statically as the library is only a convenience as the file is in a different directory.

Update (Solution):

For now creating shared instead of static libraries makes everything work. Later I will look into getting everything linking with static libraries. Thanks for everyone’s help!

  • 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-15T08:52:55+00:00Added an answer on May 15, 2026 at 8:52 am

    If no symbol is referenced in that particular file then the file will not be included by the linker. You have two options:

    1. Remove the file from library and include it (object or source file) directly in the command line for compilation/linking. Then the file should be included in executable.
    2. Have a symbol in a file which you reference from from other files (for example the one with main() definition), this should “pull” the file during linking.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a project that has 2 interfaces - windows forms
I am working a project that does not have a trunk / branches /
I have a project that I have been working on for a while, just
On a recent project I have been working on in C#/ASP.NET I have some
I have been working with Struts for some time, but for a project I
I have this project i'm working on and id like to add a really
I have a working copy of my project, checked out using Subversion 1.5.1. When
I have been working on a Java project for a class for a while
I have been working on a web services related project for about the last
One long term project I have is working through all the exercises of SICP.

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.