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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:12:42+00:00 2026-06-17T09:12:42+00:00

I have a problem, i want to compile my application with static linking of

  • 0

I have a problem, i want to compile my application with static linking of mysql connector.

My command line:

g++ -o newserver stdafx.cpp … -lboost_system -lboost_thread
-lpthread -lmysqlcppconn -static /usr/lib/libmysqlcppconn-static.a -std=c++0x

But i have error:

/usr/bin/ld: cannot find -lmysqlcppconn
/tmp/ccxpOfdZ.o: In function `IsEqualsDns(unsigned long, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
Server.cpp:(.text+0x356e): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
collect2: ld returned 1 exit status

How can i fix this?
Thanks!

  • 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-17T09:12:43+00:00Added an answer on June 17, 2026 at 9:12 am

    Where is the library libsqlcppconn.a or libsqucppconn.so
    (static or dynamic)? The compiler is looking for it, and
    doesn’t find it.

    Presumably, this is the same library as
    /usr/lib/mysqlcppconn-static.a. If so, just drop the
    -lmysqlcppconn. Or just use -lmysqlcppconn-static (no
    spaces), and forget about the /usr/lib/libmysqlconn-static.a.
    With a name like that, there shouldn’t be a corresponding .so,
    which means that g++ will link it statically, even without the
    -static. You only need the -static if there is both
    a libmysqlconn-static.so and a libmysqlconn-static.a in the
    same directory.

    With regards to the second error (which is just a warning, but
    will cause problems if you try to run the linked program on
    other machines, or even after an upgrade of your machine): if
    you use -static anywhere in your command line (as you
    currently do), then it applies to all files linked afterwards.
    Including the system libraries, which you don’t want to link
    statically. My guess is that the -static isn’t necessary (see
    above); if it is, place it immediately before the library you
    want to link statically, and place a -dynamic immediately
    after (so that any following libraries, including the system
    libraries, will be dynamically linked).

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

Sidebar

Related Questions

I have a cross platform app, I want to compile on Linux. The problem
I have an command line that uses arguments, I have no problem with this,
I have this problem: I want to generate a new source code file from
I am using GWT/JAVA for development. I have following problem: I want to remove
I have a problem and I want to implement the MVC pattern to my
I have a problem when I want to sending data using byte format in
I have problem, when I want add Node to my GUI from other Thread.
I have problem with fancybox. I want to write a function that will run
I have problem with HTTP headers, they're encoded in ASCII and I want to
I have problem with dynamically created image (JavaScript). I want to change the innerHTML

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.