-2

So I've been playing with this one for a week now and I figured it was time to call in some backup. I am currently developing some software to communicate with some boards I am developing. The boards have ft230 chips from FTDI, so I am using their FTD2XX library to interface with them. This is where the issue starts.

For the longest time I have been getting "Undefined Reference" errors for some functions and not others. So I think the linker is correct, it just isn't working for all the functions. My environment is QtCreator 3.3.0 based on QT 5.4.0. The compiler is MinGW 4.9.1. The operating system is Windows 8.1. I have downloaded the latest drivers for 8.1 from ftdichips.com. Below is the function giving me the issue:

#include <windows.h>
#include "ftdiDriver/ftdi.h"
#include <ftd2xx.h>
#include <QDebug>

void ftdiConnect(void){
    // Variables for FTDI communicaiton
    FT_STATUS ftStatus;
    FT_DEVICE_LIST_INFO_NODE *devInfo;
    DWORD numDevs;

    // create the device information list
    ftStatus = FT_CreateDeviceInfoList(&numDevs);

    if (ftStatus == FT_OK) {
        qDebug() << "Number of devices is: " << numDevs;
    }
    if (numDevs > 0) {
        // allocate storage for list based on numDevs
        devInfo = (FT_DEVICE_LIST_INFO_NODE*)malloc(sizeof(FT_DEVICE_LIST_INFO_NODE)*numDevs);

        // get the device information list
        ftStatus = FT_GetDeviceInfoList(devInfo, &numDevs);

        if (ftStatus == FT_OK) {
            for (int i = 0; i < numDevs; i++) {
                qDebug() << "Dev: " << i;
                qDebug() << " Flags: " << devInfo[i].Flags;
                qDebug() << " Type: " << devInfo[i].Type;
                qDebug() << " ID: " << devInfo[i].ID;
                qDebug() << " LocId: " << devInfo[i].LocId;
                qDebug() << " SerialNumber: " << devInfo[i].SerialNumber;
                qDebug() << " Description: " << devInfo[i].Description;
                qDebug() << " ftHandle: " << devInfo[i].ftHandle;
            }
        }
    }
}

I've searched a couple forums. It seems that most people are able to include the .lib file in their project file and things seem to work. I have tried every combination of this, and I have the same issue. Since some functions for (FT_ListDevices for example), I don't think that's the issue. It would not make sense for some functions to work and not others. I've called FTDIchips and they told me they would get back to me when they have had time to look at the issue, but had no idea of anything to try in the mean time.

If you think it would be helpful, I could include the project text in this question as well. I just didn't want it to become cluttered.

cmannett85
  • 21,725
  • 8
  • 76
  • 119
Baylis
  • 1
  • 2
    Which "Undefined Reference errors" do you get? Do you still have a main function or another entry point? – matthias Mar 03 '15 at 17:53

1 Answers1

0

Linker's "undefined references" mean (i) either you didn't provide those functions referenced (no .lib file), or (ii) you provide wrong stuff (say, 32-bit instead of 64-bit), or (iii) you asked for wrong function (wrong function name or wrong modifiers).

Anyway, it's completely your fault. You should at last read something about linking executables with external libraries and dll's, and start using your head. It's a shame to ask tech support, just because you are too lazy to read some linker's guide.

Matt
  • 13,674
  • 1
  • 18
  • 27