I am trying to use a software development kit to control a cMOS camera. The library which contains all of the functions to control the camera is called atcorem.lib. I have been trying to compile and link an example file included in the SDK which is supposed to print the serial number of the camera.
I've set things up in a Visual Studio 2013 console project, including pointing the project to Additional Include Directories, and the linker to Additional Library Directories, and Additional Dependencies. My code looks like this:
#include "stdafx.h"
#include "atcore.h"
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
int i_retCode;
cout << "Initialising ..." << endl << endl;
i_retCode = AT_InitialiseLibrary();
if (i_retCode != AT_SUCCESS) {
cout << "Error initialising library" << endl << endl;
}
else {
AT_64 iNumberDevices = 0;
AT_GetInt(AT_HANDLE_SYSTEM, L"Device Count", &iNumberDevices);
if (iNumberDevices <= 0) {
cout << "No cameras detected" << endl;
}
}
AT_FinaliseLibrary();
return 0;
}
When I try to build, the program compiles, but I receive three lnk2019 unresolved external dependencies errors.
1>ConsoleApplication1.obj : error LNK2019: unresolved external symbol _AT_InitialiseLibrary@0 referenced in function _main
1>ConsoleApplication1.obj : error LNK2019: unresolved external symbol _AT_FinaliseLibrary@0 referenced in function _main
1>ConsoleApplication1.obj : error LNK2019: unresolved external symbol _AT_GetInt@12 referenced in function _main
1>C:\Users\CAMERA1\Documents\Visual Studio 2013\Projects\ConsoleApplication1\Debug\ConsoleApplication1.exe : fatal error LNK1120: 3 unresolved externals
From using the /Verbose option with the linker, I know that it looks at atcorem.lib when it tries to resolve the functions, but doesn't seem to find them there.
Unused libraries:
1> C:\Users\CAMERA1\Desktop\temp\SDK3\atcorem.lib
1> C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\user32.lib
etc.
From searching the web and various forums, I understand that C++ calling conventions can sometimes cause problems. These are new to me, so I've tried to play with them to understand if that is a problem here. The atcorem.h header uses WINAPI, and I can see from the _fun@ format that the linker is looking for these functions as __stdcall.
In atcorem.h, this looks like
#if defined(__WIN32__) || defined(_WIN32)
#include <windows.h>
#define AT_EXP_CONV WINAPI
#else
#define AT_EXP_CONV
#endif
int AT_EXP_CONV AT_ex_format_function();
Which seems ok, based on claims that WINAPI uses __stdcall.
I have more information about the atcorem.lib from using dumpbin which I can provide if that is helpful.
Any help would be greatly appreciated. Thank you!
edit: Part of the dumpbin output. edit2: Dump of copy of atcorem.lib in desktop/temp/SDK3 directory.
Microsoft (R) COFF/PE Dumper Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file C:/Users/Camera1/Desktop/temp/SDK3\atcorem.lib
File Type: LIBRARY
Archive member name at 8: /
54B6F19F time/date Wed Jan 14 17:45:51 2015
uid
gid
0 mode
862 size
correct header end
89 public symbols
114E __IMPORT_DESCRIPTOR_atcore
1374 __NULL_IMPORT_DESCRIPTOR
14AA atcore_NULL_THUNK_DATA
2322 AT_QueueBuffer
2322 __imp_AT_QueueBuffer
27CC AT_WaitBuffer
27CC __imp_AT_WaitBuffer
16CC AT_FillBufferMode
16CC __imp_AT_FillBufferMode
1E5A AT_InitialiseLibrary
1E5A __imp_AT_InitialiseLibrary
173A AT_FinaliseLibrary
173A __imp_AT_FinaliseLibrary
...