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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:07:03+00:00 2026-06-12T18:07:03+00:00

I have a program that I am writing and that needs to calculate some

  • 0

I have a program that I am writing and that needs to calculate some hashes. I need SHA, MD, HMAC algorithms. That is why I chose openssl as solution.

My code is the following:

#include <openssl/md4.h>

void calc();

void calc(unsigned char* data, unsigned long len) {
  unsigned char* h = new unsigned char[128];
  MD4(data, len, h);
}

Compiler returns me the following:

myfile.cpp:(.text+0x3e): undefined reference to `MD4′ collect2: ld
returned 1 exit status

I compile simply using:

g++ myfile.cpp -o myapp.o

under Linux Fedora.

I downloaded openssl libraries from here and compiled them cby using ./configure and then make install in the downloaded untarpalled directory. I also copied in /usr/local/include directory the include directory in the one I downloaded so that headers can be found by compiler because /usr/local/include is in my $PATH env var.

However the problem is that the linker cannot find the function. I understand that the reason might be two:

  • The compiler can find headers but cannot find implementations.
  • There are problems because openssl is written in C not in C++.

How should I proceeed? Thankyou

Edit1

I actually changed something in my openssl installation.

I installed openssl again and I could see that it places everything under /usr/local/ssl where I can find /usr/local/ssl/include and /usr/local/ssl/lib directories. I change my compilation string in:

g++ -I/usr/local/ssl/include -L/usr/local/ssl/lib -lssl -lcrypto

In the directories that I mentioned before I can find, respectively, /usr/local/ssl/include/openssl directory with all headers there and /usr/local/ssl/lib/libssl.a and /usr/local/ssl/lib/libcrypto.a libraries.

Before I did this change when I used the old compilation command, the compiler was telling me: Cannot find -lssl. With these changes, now it can find libs and headers, but ld always fails in the same way:

myfile.cpp:(.text+0x3e): undefined reference to `MD4′ collect2: ld
returned 1 exit status

A little disappointed.
What do you think?

  • 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-12T18:07:04+00:00Added an answer on June 12, 2026 at 6:07 pm

    Linking against openssl usually requires -lssl.

    g++ -o myapp myfile.cpp -lssl 
    

    By the way, it sounds like you may have done the installation a little incorrectly.

    You shouldn’t have to copy header files anywhere. And you may not have copied the shared libraries anyway.

    The compilation should go something like this:

    ./configure --prefix=/usr/local/openssl
    make
    make install
    

    And then you compile your program like:

    g++ -c -o myapp1.o myfile1.cpp -I/usr/local/openssl/include
    g++ -c -o myapp2.o myfile2.cpp -I/usr/local/openssl/include
    g++ -o myapp myapp1.o myapp2.o -I/usr/local/openssl/include -L/usr/local/openssl/lib -lssl -lcrypto
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a program in C that needs to do some fast math calculations.
I'm writing a moderately complex iOS program that needs to have multiple threads for
Im writing a program that should read input via stdin, so I have the
I have a problem with Regular Expressions. I'm writing a small program that matches
I have a table that contains log entries for a program I'm writing. I'm
I'm starting to learn about COBOL. I have some experience writing programs that deal
I am writing a program that needs to read a set of records that
I'm currently writing a program that needs to compare each file in an ArrayList
I'm writing a program that needs a generic temp folder. I'm trying to find
I'm writing a program that among other things needs to download a file given

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.