fatal error LNK1120:

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2008
Posts: 12
Reputation: Elmismo is an unknown quantity at this point 
Solved Threads: 0
Elmismo Elmismo is offline Offline
Newbie Poster

fatal error LNK1120:

 
0
  #1
Nov 11th, 2008
Hi, I have these errors:

--------------------Configuration: IP_devllink_06 - Win32 Debug--------------------
Linking...
IP_devlink_06.obj : error LNK2001: unresolved external symbol _DLClose@4
IP_devlink_06.obj : error LNK2001: unresolved external symbol _DLOpen@24
Debug/IP_devllink_06.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

IP_devllink_06.exe - 3 error(s), 0 warning(s)

The probloem is that I am including my header in the project, and the name of these functions are the same (DLOpen and DLClose) when I compile, it runs well but when I try to Build the Link doesn't work

Any idea to solve it?

Thanks in advance.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 273
Reputation: Sci@phy will become famous soon enough Sci@phy will become famous soon enough 
Solved Threads: 42
Sci@phy's Avatar
Sci@phy Sci@phy is offline Offline
Posting Whiz in Training

Re: fatal error LNK1120:

 
0
  #2
Nov 11th, 2008
Please post at least head of your header file...

Until then, this: googleing!

says this:

Linker Tools Error LNK2001

unresolved external symbol "symbol"

Code references something (such as a function, variable, or label) that the linker can't find in the libraries and object files.

Possible causes

* What the code asks for doesn't exist (the symbol is spelled incorrectly or uses the wrong case, for example).
* The code asks for the wrong thing (you are using mixed versions of the libraries, some from one version of the product, others from another version).

This error message is followed by fatal error LNK1120.
Last edited by Sci@phy; Nov 11th, 2008 at 5:19 pm.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: fatal error LNK1120:

 
0
  #3
Nov 11th, 2008
Insufficient info.
As usually, no function definitions in the header. Where are these functions bodies? The linker can't obtain them. Check out all sources, libraries and the project settings.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 12
Reputation: Elmismo is an unknown quantity at this point 
Solved Threads: 0
Elmismo Elmismo is offline Offline
Newbie Poster

Re: fatal error LNK1120:

 
0
  #4
Nov 11th, 2008
this is my header code, and I am including in the project:

[/********************************************************************/
/* */
/* C/C++ Header File (c) 2001 Avaya Global SME Solutions */
/* */
/* Contents:- */
/* IP Office Dev link DLL provides an interface for managing */
/* the IP Office product ranges from a Windows PC. */
/********************************************************************/
#ifndef _DEVLINK_H_
#define _DEVLINK_H_
typedef char TEXT;
#define DEVLINK_SUCCESS - 0
#define DEVLINK_UNSPECIFIEDFAIL 1
#define DEVLINK_LICENCENOTFOUND 2
#define DEVLINK_COMMS_OPERATIONAL 0
#define DEVLINK_COMMS_NORESPONSE 1
#define DEVLINK_COMMS_REJECTED 2
#define DEVLINK_COMMS_MISSEDPACKETS 3
#ifdef __cplusplus
extern "C"
{
#endif
typedef void (CALLBACK * CALLLOGEVENT)(
LONG pbxh,
TEXT * info
);
typedef void (CALLBACK * COMMSEVENT)(
LONG pbxh,
DWORD comms_state,
DWORD parm1
);
LONG PASCAL DLOpen( HANDLE pbxh
, TEXT * pbx_address
, TEXT * pbx_password
, TEXT * reserved1
, TEXT * reserved2
, COMMSEVENT cb
);
LONG PASCAL DLClose( LONG pbxh );
LONG PASCAL DLRegisterType2CallDeltas( LONG pbxh, CALLLOGEVENT cb );
#ifdef __cplusplus
};
#endif
#endif // _DEVLINK_H_]

I have the same name for these (DLOpen - DLClose) but even have the Link error...
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: fatal error LNK1120:

 
0
  #5
Nov 11th, 2008
Please, read my previous post again (and again ).
Where are these two functions DEFINED???
You post DECLARATIONS (prototypes) of these functions.

For example, I (header file) declare: I have 2000000000$.
You (linker) ask me: where are this lots of money?
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 12
Reputation: Elmismo is an unknown quantity at this point 
Solved Threads: 0
Elmismo Elmismo is offline Offline
Newbie Poster

Re: fatal error LNK1120:

 
0
  #6
Nov 11th, 2008
this is my .cpp code where i call these functions, I'm including the
#include "devlink.h"
instruction and
#include "stdAfx.h"
that I read I need to get the Link

[#include "stdAfx.h"
#include <windows.h>
#include <stdio.h>
#include "devlink.h"
LONG hEvent;
DWORD dwCommsEvent;
BOOL bStarting;
void CALLBACK HandleCommsEvent( LONG pbxh, DWORD comms_evt, DWORD parm1 )
{
switch( comms_evt ) {
case DEVLINK_COMMS_OPERATIONAL:
// we are working fine... fall through
case DEVLINK_COMMS_NORESPONSE:
// system not found (initial connection),
// or network connection lost (rebooted?)
// fall through...
case DEVLINK_COMMS_REJECTED:
// incorrect system password specified...
if( bStarting ) {
dwCommsEvent = comms_evt;
SetEvent( hEvent );
}
else {
// insert your code here...
}
break;
case DEVLINK_COMMS_MISSEDPACKETS:
// Indicates that the system is under
// heavy load. IP Office always prioritises
// data routing and call handling above CTI events.
// (parm1 contains the number of packets missed)
break;
}
}
int main(int argc, char* argv)
{
printf( "connecting...");
bStarting = TRUE;
hEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
DLOpen( 0,
"255.255.255.255",
"systempassword",
NULL,
NULL,
HandleCommsEvent );
dwCommsEvent = DEVLINK_COMMS_NORESPONSE;
WaitForSingleObject( hEvent, 10000L ); // 10 seconds
bStarting = FALSE;
if( dwCommsEvent == DEVLINK_COMMS_OPERATIONAL ) {
printf("Connected OK\n");
}
else {
printf("Error connecting to IP Office\n");
}
DLClose( 0 );
CloseHandle( hEvent );
return 0;
}]
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: fatal error LNK1120:

 
0
  #7
Nov 11th, 2008
Ooh... I know English is not my native language but...

I'm not interesting where you CALL these functions.
My question was: where were these two functions defined? A function definition code looks like
  1. type function_name(parameters)
  2. {
  3. function_body
  4. }
Where is
  1. LONG PASCAL DLOpen(....)
  2. {
  3. ...
  4. }
???
Probably these functions were placed in the library. Did you attach this library to your project? Where is this library?..
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 12
Reputation: Elmismo is an unknown quantity at this point 
Solved Threads: 0
Elmismo Elmismo is offline Offline
Newbie Poster

Re: fatal error LNK1120:

 
0
  #8
Nov 11th, 2008
these are in my header file (devlink.h) and the code is:

  1. LONG PASCAL DLOpen( HANDLE pbxh
  2. , TEXT * pbx_address
  3. , TEXT * pbx_password
  4. , TEXT * reserved1
  5. , TEXT * reserved2
  6. , COMMSEVENT cb
  7. );
  8. LONG PASCAL DLClose( LONG pbxh );

I'm including my header file (devlink.h) as part of my project, and put the instruction to "LINK"
#include "devlink.h"
in my .cpp code, (I send the complete code in previous messages)
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: fatal error LNK1120:

 
0
  #9
Nov 12th, 2008
I see you don't understand a difference between a function declaration (prototype) and a functions definition (header+body). The DLOpen function prototype in your header file is not the DLOpen function. It's a declaration only. You declare (to compiler): "See, I have this function elsewhere. Let this functions calls in my code below correspond the prototype". A prototype does not generate machine code. If you call DLOpen in your program, you must have this function definition (header+body) in your source codes or in an external library (included in the project).

Obviously you don't know where is DLOpen and where is DLClose source or object codes.
I don't know as well...
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 12
Reputation: Elmismo is an unknown quantity at this point 
Solved Threads: 0
Elmismo Elmismo is offline Offline
Newbie Poster

Re: fatal error LNK1120:

 
0
  #10
Nov 14th, 2008
I found these functions in dlfcn.h and I need to add the cdefs,h
I include in my projects, but now I have this error:

Deleting intermediate files and output files for project 'prueba_IP_devlink_08 - Win32 Debug'.
--------------------Configuration: prueba_IP_devlink_08 - Win32 Debug--------------------
Compiling...
prueba_08.cpp
Linking...
dlfcn.h : fatal error LNK1136: invalid or corrupt file
Error executing link.exe.

prueba_IP_devlink_08.exe - 1 error(s), 0 warning(s)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC