0

I'm trying to get this code to work (some old wallwasher lights, so no customer support):

#include <stdio.h>
#include <cstdlib> //system()
#include <conio.h>
#include <windows.h>
#include "IamBX.h"
#include "IamBX_Light.h"

int main()
{
    // Setup amBX Interface and Device Interfaces
    IamBX* pIamBX;
    IamBX_Light *apIamBXLight[9]; // Create lib instance (struct)

    amBXCreateInterface(&pIamBX, 1, 0, "test", "test", NULL, 0);

    // ...

but I get

undefined reference to `amBXCreateInterface'

I have all these files in the working dir:

Directory Listing

Dependency Walker:

Dependency Walker on ambxrt.dll

NOTE: amBXCreateInterface is a function from ambxrt.dll, I just don't know how to use it and Google didn't end up being of much use.

NOTE 2: I'm building it using MinGW's g++, tried the -lm flag but it gives the same output

yanko
  • 164
  • 9
  • 1
    Do you have a ambxrt.lib somewhere? If yes, you must pass this file to your linker. Just having ambxrt.dll in your source dir isn't enough. – m88 Mar 02 '21 at 10:14
  • @m88, yes, I have it in the working directory (see screenshot). I don't know how to use linker, I'm a nodeJS guy. Can you help me out here? – yanko Mar 02 '21 at 10:17
  • 1
    You already linked to `m` by doing `-lm` so it's the same thing: `-lambxrt`. And possibly `-L/path/to/your/libs` – m88 Mar 02 '21 at 10:19
  • @m88 can that path be relative? e.g. `-l./lib` – yanko Mar 02 '21 at 10:23
  • Either way, it gives the same error, this is how my flags look like: https://prnt.sc/10b7uc8 – yanko Mar 02 '21 at 10:30
  • 1
    I don't see `-lambxrt` and whatever's after that `-L` doesn't look like a valid path (-L specifies a DIR path where the linker will look for (lib)SOMETHING(.dll|.lib) specified by `-lSOMETHING`. – m88 Mar 02 '21 at 10:33
  • Corrected to [this](https://pasteboard.co/JQJJT5e.png), now i have `cannot find -lambxrt` as output – yanko Mar 02 '21 at 10:42
  • 1
    `-L"C:/Path/To/Your/Dir"` – m88 Mar 02 '21 at 10:49
  • same error. it seems like the error comes from the `-l` flag, rather than the `-L` one – yanko Mar 02 '21 at 10:52
  • 1
    The `-l` fails because you're probably screwing up your `-L` argument. Or it doesn't contain your .lib (not just your .dll). – m88 Mar 02 '21 at 11:03
  • - Removed spaces from dir, replaced with underscores - Tried both .dll and .lib, both directories are valid – yanko Mar 02 '21 at 11:06
  • 1
    What do you mean "both directories"? They should both be in the same directory, the one after `-L`. And their name should be the same except for their extension. And this name is what should be given after `-l`. – m88 Mar 02 '21 at 12:44
  • they are both in the same directory. I meant both files (dll and lib). Also their name is equal, just extension changes – yanko Mar 02 '21 at 12:45
  • 1
    Well, maybe `ambxrt.lib` doesn't export the symbol you need then. Ask whoever compiled it if they have a minimal working example with MinGW. Can't really help beyond that. – m88 Mar 02 '21 at 13:10
  • Unfortunately, this is an obsolete 2007 library. It's the API for their hardware, yet the company no longer provides support for this – yanko Mar 02 '21 at 13:11

0 Answers0