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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:26:04+00:00 2026-06-15T08:26:04+00:00

I am using ACE6.0.2 on a Suse 11 x86 machine.The version of gcc is

  • 0

I am using ACE6.0.2 on a Suse 11 x86 machine.The version of gcc is 4.3 and ACE-TAO lib has been compiled with no problem.

The test I wanted to do is very simple but it just can’t pass.

I have three files.
a1.h defines a class A.

class A 
{ 
    public: 
        A(); 
        void print(); 
};

a1.cpp has a function invoking the method from ACE lib.

#include "a1.h" 
#include <ace/Thread.h> 
#include <iostream> 

A::A(){} 

void A::print() 
{ 
    long t=ACE_Thread::self(); 
    std::cout<<t<<std::endl; 
} 

main.cpp invokes print() from class A

#include "a1.h" 

int main() 
{ 
    A a; 
    a.print(); 
    return 0; 
} 

The compiling command I used is:

1.generate a1.o with ACE_thread

g++ -c -fPIC -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -O3 -ggdb -pthread -Wall -W -Wpointer-arith -pipe -D_GNU_SOURCE -I/opt/ACE_wrappers -DACE_HAS_VALGRIND -D__ACE_INLINE__ -I.. -Wl,-E -L/opt/ACE_wrappers/lib -L. -o a1.o a1.cpp

2.generate shared libT.so

g++ -pthread -Wl,-O3 -shared -o libT.so a1.o -Wl,-E -L/opt/ACE_wrappers -L. -L/opt/ACE_wrappers/lib -lACE -ldl -lrt

3.generate main.o

g++ -c -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -O3 -ggdb -pthread -Wall -W -Wpointer-arith -pipe -D_GNU_SOURCE -I/opt/ACE_wrappers -DACE_HAS_VALGRIND -D__ACE_INLINE__ -I.. -Wl,-E -L/opt/ACE_wrappers/lib -L. -o main.o main.cpp -lACE -ldl -lrt

4.link and generate the executable file

g++ -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -O3 -ggdb -pthread -Wall -W -Wpointer-arith -pipe -D_GNU_SOURCE -I/opt/ACE_wrappers -DACE_HAS_VALGRIND -D__ACE_INLINE__ -I.. -Wl,-E -L/opt/ACE_wrappers/lib -L. -o main main.o -lT -lACE -ldl -lrt

The problems occurred at step 4:

main.o: In function `main': 

/main.cpp:5: undefined reference to `A::A()' 
/main.cpp:6: undefined reference to `A::print()' 

I am new to C++ under linux and don’t understand why this happens. There must be something wrong with my compiling commands.Thanks for help in advance.

  • 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-06-15T08:26:06+00:00Added an answer on June 15, 2026 at 8:26 am

    Well, you have just enabled -fvisibility=hidden flag which makes all symbols hidden by default. As a result, your class A is not visible to anything outside the shared library you have compiled.

    There are two solutions:

    1. Do not use -fvisibility=hidden flag. This will make all symbols visible by default.
    2. Mark A class (and pretty much everything else that you want to access in your shared library from “the outside world”) as public. This is compiler-specific and is usually done with macros. For more information on gcc, see GCC Visibility Wiki.

    Just to make it clear, this issue is yours and yours only. It has absolutely nothing to do with Ace or any other library.

    Hope it helps. Good Luck!

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

Sidebar

Related Questions

Using C++ preprocessor directives, is it possible to test if a preprocessor symbol has
Using these images: (333x300) (1680x1050) and this layout: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent
Using php's DOMDocument->LoadHTMLFile('test.html'); keeps on returning an error to me, reporting for an error
Using Visual Studio / C#, I've been debugging some nunit tests recently, and am
using VB.Net2010 I need to call a C# DLL The problem I have is
Using Play 2.1-RC1 I can't write simple test. Here's the action code: def echoTestTagFromXml
Using my own controller, I'm adding a product to the Magento cart. It has
Using a CSS image sprite, I'm creating an 'interactive' image where hovering over certain
Using a populated Table Type as the source for a TSQL-Merge. I want to
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question

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.