dllimport function not allowed

This is a discussion on dllimport function not allowed within the C++ Programming forums, part of the General Programming Boards category; Hello
I have downloaded this code from the internet and I am trying to compile it. Howerver, I keep getting ...

// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the NATIVEDLL_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// NATIVEDLL_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef NATIVEDLL_EXPORTS
#define NATIVEDLL_API extern "C" __declspec(dllexport)
#else
#define NATIVEDLL_API __declspec(dllimport)
#endif
// ********************************************************
// Callback function type definition for a function that is
// called when the processing performed by the native DLL
// is complete
//
// Function has no return value & no parameters.
// Example: void MyWorkCompleteFunction()
typedef void (CALLBACK *NATIVEWORKCOMPLETEPROC)();
// Callback function type definition for a function that is
// is called within each iteration of the native processing
// loop. Native processing will continue until the provided
// function returns 0;
//
// Function has BOOL return value (int in C#, Integer in VB.NET)
// Function accepts an LPARAM as a parameter (IntPtr in .NET CF)
// The LPARAM parameter passes application defined data
// back to the application. The LPARAM is initially provided
// to the native DLL on the call to StartNativeProcessingWithControlProc
// function.
typedef BOOL (CALLBACK *NATIVEWORKCONTROLPROC)(LPARAM lParam);
// ********************************************************
// Initiate processing on a background thread. When processing is complete,
// the workCompleteProc callback function is called
NATIVEDLL_API void StartNativeProcessing(NATIVEWORKCOMPLETEPROC workCompleteProc);
// Initiate processing on a background thread. On each iteration of the
// loop, the workControlProc function is called with the lParam passed
// as a parameter. The processing on the background thread continues
// until the workControlProc callback function returns 0. When processing
// is complete, the workCompleteProc callback function is called
NATIVEDLL_API void StartNativeProcessingWithControlProc(
NATIVEWORKCONTROLPROC workControlProc, LPARAM lParam, NATIVEWORKCOMPLETEPROC workCompleteProc);

Wait, I just realized that my change just masked the error instead of fixing it. I don't have the time right now to explain the problem or the proper fix, but the DLL as it is now is probably unusable.

Revert the change and add NATIVEDLL_EXPORTS to the project-wide predefined macros.

I understand how the # and preprocessor works.
However, how do I define NATIVEDLL_EXPORTS, what value do I initially give it.?
To set this value do I have to go to properties | C/C++ | preprocessor? I have never done anything like this before, so not sure.

Yes, that's where it goes. The value doesn't matter - just add the symbol. It will have the value 1 by default, which is just fine.

OK, the issue here is the following: the __declspec(dll*) stuff is an MS-specific feature that effectively tells the compiler that this function is to be either exported from the DLL that is currently compiled, or to be imported from a DLL, depending on whether it's dllexport or dllimport, of course.
The DLL, when being compiled, needs dllexport declarations on all its externally visible functions. A program that uses the DLL needs the dllimport declarations. In order to be able to use the same header file for both, the macro switch was created.
Because requiring client programs to define symbols just to make the DLL work is not nice, the switch defaults to importing. This means that when compiling the DLL, the switch trigger must be defined. The switch trigger in your case is NATIVEDLL_EXPORTS.