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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:00:35+00:00 2026-05-27T08:00:35+00:00

I’ve got hold of libarchive and built the examples on both Windows and Linux

  • 0

I’ve got hold of libarchive and built the examples on both Windows and Linux following the build instructions.

I now want to use this library in my project, which is Qt based, so I’m using Qt creator. I’ve added the include paths for libarchive in my pro file, but when I compile I get errors saying “undefined reference to ‘imp_archive_read_new'” and so on.

This is my code at the moment:

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <stdint.h>
    #include "archive.h"
    #include "archive_entry.h"

    cTarFileManager::cTarFileManager()
    {
      struct archive *a;
      struct archive_entry *entry;
      int r;
      int64_t entry_size;
      a = archive_read_new();
      archive_read_support_compression_none(a);
      archive_read_support_format_tar(a);
      r = archive_read_open_filename(a, "0000.tar", 1024);
      if (r != ARCHIVE_OK)
      {
        printf("archive not found");
      }
      else
      {
        while (archive_read_next_header(a, &entry) == ARCHIVE_OK)
        {
          const char *currentFile = archive_entry_pathname(entry);
          char *fileContents;
          entry_size = archive_entry_size(entry); //get the size of the file
          fileContents = (char*)malloc(entry_size); //alloc enough for string - from my testing I see that this is how many bytes tar and ls report from command line
          archive_read_data(a, fileContents, entry_size); //read data into fileContents string for the HTML file size
          if(strcmp(currentFile, "vendar-definition.html") == 0)
          {
            printf("file name = %s, size = %ld\n", currentFile, entry_size);
            printf("%s\n\n", fileContents); //this output over-reads chars from another file in this tar file
          }
          free(fileContents); //free the C string because I malloc'd
        }
      }
      printf("exit");
    }

Here is the full list or errors I get:
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:16: undefined reference to _imp__archive_read_new'
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:17: undefined reference to
imp_archive_read_support_compression_none’
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:18: undefined reference to _imp__archive_read_support_format_tar'
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:19: undefined reference to
imp_archive_read_open_filename’
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:28: undefined reference to _imp__archive_entry_pathname'
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:30: undefined reference to
imp_archive_entry_size’
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:32: undefined reference to _imp__archive_read_data'
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:26: undefined reference to
imp_archive_read_next_header’
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:16: undefined reference to _imp__archive_read_new'
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:17: undefined reference to
imp_archive_read_support_compression_none’
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:18: undefined reference to _imp__archive_read_support_format_tar'
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:19: undefined reference to
imp_archive_read_open_filename’
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:28: undefined reference to _imp__archive_entry_pathname'
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:30: undefined reference to
imp_archive_entry_size’
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:32: undefined reference to _imp__archive_read_data'
D:\Tar-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug/../Tar/TarFileManager.cpp:26: undefined reference to
imp_archive_read_next_header’

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

    As I suspected, it’s a linking problem. You do not actually link with the library. I don’t know how you do it in Qt Creator, but you have to add the flags -L/path/to/library/folder and -lname_of_library to the linking stage.

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

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.