View Full Version: error 2059

C++ Learning Community > C++ Help > error 2059


Title: error 2059


wanderinglazyeye - January 27, 2007 10:55 PM (GMT)
Hi folks I am dealing with error code 2059 when I inserted the "solution code" for a linker error from MSDN. The linker error is fixed but now I can't find a solution for the new error ( BUG: C2059 Error on Out-Of-Class Definition of Member Templates)

Solution code:

template class __declspec(dllimport) CStringT<TCHAR, StrTraitMFC<TCHAR, ChTraitsCRT<TCHAR> > >;
template class __declspec(dllimport) CSimpleStringT<TCHAR>;

So I reverted to the old solution and added ATL libraries. Unfortunately, it can't find atlstr.h as it is not supported in the *Express* version. Uggh. Looks like to use the ATL libraries I'm going to have to upgrade. SUX!

myork - January 28, 2007 03:17 PM (GMT)
QUOTE (wanderinglazyeye @ Jan 27 2007, 05:55 PM)
Hi folks I am dealing with error code 2059 when I inserted the "solution code" for a linker error from MSDN. The linker error is fixed but now I can't find a solution for the new error ( BUG: C2059 Error on Out-Of-Class Definition of Member Templates)

Solution code:

template class __declspec(dllimport) CStringT<TCHAR, StrTraitMFC<TCHAR, ChTraitsCRT<TCHAR> > >;
template class __declspec(dllimport) CSimpleStringT<TCHAR>;

So I reverted to the old solution and added ATL libraries. Unfortunately, it can't find atlstr.h as it is not supported in the *Express* version. Uggh. Looks like to use the ATL libraries I'm going to have to upgrade. SUX!



Need more information:
Error C2059 is just a syntax error.

We need:
1) The full error message.
2) The line of code that caused the error (plus 5 lines either side)
3) Any class definitions that are relavant.

wanderinglazyeye - January 29, 2007 02:04 AM (GMT)
1.
CODE

Linking...
MVM.obj : error LNK2019: unresolved external symbol __imp__FclInitialize@48 referenced in function _wWinMain@16
C:\Documents and Settings\*********\My Documents\Visual Studio 2005\Projects\MVM\Debug\MVM.exe : fatal error LNK1120: 1 unresolved externals


2.
CODE
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);

 // TODO: Place code here.
// ******************************************
// INITIALIZE Camera
/* Input Values */
LPCSTR         filterName = "MVMCam";
CapInfoStruct  capInfo;
/* Initialise capInfo here */

/* Output Values */
int            index;
HANDLE         hImager;

/* Call function */
FclInitialize(filterName,index,capInfo,&hImager);

// End TODO code
//******************************************************
MSG msg;

HACCEL hAccelTable;

// Initialize global strings

Visual Express....

simply add in the code in the beginning of the post in the TO DO section per MSDN article to resolve and the 2019 and 1120 errors go away but new syntax error crops up. The code is snipped directly from the MSDN article.

myork - January 30, 2007 03:14 PM (GMT)
QUOTE (wanderinglazyeye @ Jan 28 2007, 09:04 PM)

simply add in the code in the beginning of the post in the TO DO section per MSDN article to resolve and the 2019 and 1120 errors go away but new syntax error crops up. The code is snipped directly from the MSDN article.


This is a read hearing.
Basically you introduce a Syntax error so the code does not compile and thus the linker is never invoked (thus the 2019 and 1120 errors are not displayed).

The real problem is you have a function
CODE
FclInitialize()
but there is no definition for this function.

You need to things.
1) A header file that declares the function correctly.
(You should #include this file)
2) A library (or source file) that defines the function.
(You should add the library to the linker phase).

Both these actions MUST be performed.

So my next question is:
1) Where is this function from (I can not find it on Google).
2) Do you have the appropriate objects?

wanderinglazyeye - January 31, 2007 04:28 AM (GMT)
Objects and header files I think are correctly referenced. I include FcAPIUser.h at the beginning of the program and the Linker directory is pointed at the folder containing the library file. Both are supplied by the manufacturer. Manufacturer documentation states only that you include FcAPIUser.h and link to FcAPI.lib (which is in the same folder). I can post the header file if that would be helpful. So if the linker is pointed, why the error?

myork - January 31, 2007 02:59 PM (GMT)
QUOTE (wanderinglazyeye @ Jan 30 2007, 11:28 PM)
and the Linker directory is pointed at the folder containing the library file.


OK.

But did you add FcAPI.lib to the list of libraries that you need to link against?
Adding the directory containing the file is not enough.

adeyblue - January 31, 2007 03:57 PM (GMT)
In case you don't know where to specify additional libraries its:
Project Properties->Linker->Input->Additional Dependencies
(don't forget to add it for both debug and release configurations)

or since you're using VC++ you can do it in a source file by adding:
#pragma comment(lib, "FcAPI.lib")

wanderinglazyeye - February 1, 2007 05:18 AM (GMT)
Under "Linker" --> "Input"-->"Additional Dependencies" I have typed in the file location and it says it can't open it. I beleive my syntax must be wrong:

c:\programfiles\fclab\api\fcapi.obj

The file is fcapi listed as a "library object file". I've tried .lib as well. There is no option in VSExpress to create a resource file (have to upgrade). I'm doing something stupid obviously what is it.

myork - February 1, 2007 04:02 PM (GMT)
QUOTE (wanderinglazyeye @ Feb 1 2007, 12:18 AM)
Under "Linker" --> "Input"-->"Additional Dependencies" I have typed in the file location and it says it can't open it. I beleive my syntax must be wrong:

c:\programfiles\fclab\api\fcapi.obj

The file is fcapi listed as a "library object file". I've tried .lib as well. There is no option in VSExpress to create a resource file (have to upgrade). I'm doing something stupid obviously what is it.

In the linker section there are two things you need to fill out:

1) Addition Library Directories.
In this section you need to add the directory where the lib lives.
CODE
c:\Program Files\fclab\api\
NB. Different directories are separated by a semicolon ";".

PS. Program Files Space between words.

2) Additional Dependencies
In this section add the name of the library
CODE
FcAPI.lib
NB. Different libraries are separated by a space.

wanderinglazyeye - February 2, 2007 08:26 PM (GMT)
Thanks very much, that seemed to do the trick.

WLE




* Hosted for free by InvisionFree