0

Problem

I am attempting to compile the following files and I get multiple undefined reference errors. I am unsure of what the problem is.

How I compile

g++ enigma.cpp send.cpp -o send

Error messages

ccg6buM6.o:send.cpp:(.text+0x843): undefined reference to `enigma(char*)'
ccg6buM6.o:send.cpp:(.text+0x843): undefined reference to `enigma(char*)'
collect2.exe: error: ld returned 1 exit status 

Code

enigma.hpp:


    using namespace std;

    #ifndef ENIGMA_HPP
    #define ENIGMA_HPP

    char* enigma(char* message);

    #endif

enigma.cpp

    using namespace std;

    int find(char arr[], char seek);
    struct Rotor;
    struct Reflector;
    struct Machine;

    extern "C" char* enigma(char* message)
    {
        Machine enig;
        int index;
        char letter;

        // Encrypts message

        return message;
    };

send.cpp

#include "enigma.hpp"

int main(int argc, char *argv[]) {
    cout << enigma("Hello") << endl;
    return 0;
}

thomaoc
  • 94
  • 10

0 Answers0