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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:50:12+00:00 2026-05-12T15:50:12+00:00

I am trying to build libdecodeqr on a mac. My c++ building and linking

  • 0

I am trying to build libdecodeqr on a mac. My c++ building and linking history is all on windows, so it’s an exciting journey of discovery.

I have finally got to the point where I want to create the linked library. The command I am running is:

g++ -shared -o libdecodeqr.so.0.9.3 bitstream.o codedata.o container.o ecidecoder.o formatinfo.o galois.o imagereader.o libdecodeqr.o -L/opt/local/lib -arch i386 -lcxcore -lcv

The result is:

Undefined symbols:
    "_main", referenced from:
       start in crt1.10.5.o

I was under the impression that a creating a library using -shared flag meant I shouldn’t need a main function. There certainly isn’t one in the source code.

Just for kicks I added int main() {return 0;} to one of the cpp files and rebuilt. The whole thing compiled and linked, but when I tried to use the output as a library I got errors telling me that I can’t link to a main executable. That makes sense I guess.

Is there something else I need to pass to g++ to tell it to build a library?

  • 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-12T15:50:12+00:00Added an answer on May 12, 2026 at 3:50 pm

    -shared is not supported on OSX. Use either -dynamiclib or -bundle (depending on which type of shared library you want to create).

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

Sidebar

Related Questions

I'm trying to build a basic application which will have 2 separate components which
I'm trying build my application using REST and Spring MVC. For some entities I
Trying to build a legacy code in VS2005 and get errors in VC header
Trying to build Android open source project on Ubuntu 10.04 (on VMware Player). I
Im trying to build a small frame that displays an image. My problem is
I'm trying to build a search that is similar to that on Google (with
I'm trying to build a conversation list for SMS messages. Therefore I'm reading content://sms/conversations
I'm trying to build a table layout similar to this --------------------------------------------------------------------- | 01.01.2010 01:00
I am trying to build a custom toggle button in Android, I want it
I'm trying to build custom AuthorizeAttribute, so in my Core project (a class library)

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.