sigil
sigil

Reputation: 9546

unresolved external symbol, but I included files with the function definitions?

I'm writing a C++ console app to test an API. I added the ...\SDK\include\ folder path under "Additional Include Directories." Here's the code for my main .cpp file:

#include "stdafx.h"
#include <iostream>
#include "aaapi.h"
#include "aaapidef.h"
#include "aaapiver.h"
#include "aaatypes.h"
#include "aadmsapi.h"
#include "aadmsdef.h"

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    LPCWSTR dbName=L"xyz.com:abc";
    LPCWSTR user=L"";
    LPCWSTR pwd=L"";
    LPCWSTR schema=L"";
    bool resultInit=aaApi_Initialize(AAMODULE_ALL);
    bool resultLogin=aaApi_Login(AAAPIDB_UNKNOWN,dbName,user,pwd,schema);
    return 0;
}

I'm getting these errors:

unresolved external symbol _aaApi_Initialize@4 referenced in function _wmain
unresolved external symbol _aaApi_Login@20 referenced in function _wmain

From the errors, it seems like both of the API functions are undefined, but I thought the #include statements would have taken care of that, especially because their function headers show up in the Intellisense.

What am I missing here?

Upvotes: 2

Views: 1909

Answers (1)

user207421
user207421

Reputation: 310907

The #include statements are for the compiler. The message is from the linker. You have to tell it where the corresponding .obj files are.

Upvotes: 2

Related Questions