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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:05:20+00:00 2026-06-07T00:05:20+00:00

My project consists of an app that links to two static libraries. Each of

  • 0

My project consists of an app that links to two static libraries. Each of the libraries declares Q_DECLARE_METATYPE< QUuid >, in order to use QUuid with QVariant, which leads to a 'redefinition of struct QMetaTypeId< QUuid >' error.

What is the correct way to go about this while keeping the ability to use each library on its own in different projects?

  • 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-07T00:05:22+00:00Added an answer on June 7, 2026 at 12:05 am

    As a workaround you can call the Q_DECLARE_METATYPE macro from the implementation files that need it instead of calling it from the header files, or as the documentation suggests, call it from private headers in each library.

    But because QUuid stores its content as a QByteArray which is already supported by QVariant, you don’t need to use Q_DECLARE_METATYPE to do that (from Qt 4.8 only):

    // QVariant variant;
    // QUuid uuid;
    variant = uuid.toByteArray();
    uuid = variant.toByteArray();
    

    or the same thing, but a little less efficiently, with QString (before Qt 4.8):

    variant = uuid.toString();
    uuid = variant.toString();
    

    And since QVariant will implicitly convert between QString and QByteArray, you can mix toString and toByteArray without any problem.

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

Sidebar

Related Questions

I have a project that consists of several modules (app. 10-12). I use maven
I'm working on a server-side project that consists of several services. Each service is
I have two tables: projects and tasks. A project consists of tasks. I want
Basically I have a series of projects displayed on the page. Each project consists
I have a university project which is already 99% completed. It consists of two
I'm trying to build a medium-size project in Eclipse. It consists of main app
I'm trying to distribute this app that I wrote in python. The application consists
I have a project that consists of a C# application that calls into a
I currently work into a big project that consists of lots of classes. Can
I want to create an EAR project that consists of an EJB 3.1 module

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.