Computing.Net > Forums > Programming > How To Link A C++ Library

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

How To Link A C++ Library

Reply to Message Icon

Original Message
Name: DecPC
Date: January 30, 2004 at 06:15:04 Pacific
Subject: How To Link A C++ Library
OS: W2K
CPU/Ram: AMD800/512MB
Comment:

I try to test the Win API function: NetMessageBufferSend

I wrote a Visual C++ console program. This program calls
the NetMessageBufferSend to send a message to my own
machine ( similar to "net send * Test" ). But I can not
run this program. I can compile this program.
But I can not link this program. The error I get is:

Q1 error LNK2019: unresolved external symbol
_NetMessageBufferSend@20 referenced in
function _main
Q1 fatal error LNK1120: 1 unresolved externals


The program is as follows:
========================================
#include "stdafx.h"
#include <Windows.h>
#include <Lm.h>

int _tmain( int argc, _TCHAR* argv[] ) {
BYTE A[100] = "Test";
NetMessageBufferSend( NULL,
NULL,
NULL,
A,
100 );
return 0; }
========================================

The MSDN online help for NetMessageBufferSend
is as follows:
========================================
Requirements:
Windows NT/2000 or later: Requires Windows NT
3.1 or later.
Windows 95/98/Me: Unsupported.
Header: Declared in Lmmsg.h; include Lm.h.
Library: Use Netapi32.lib.
========================================

Looks like I have to link the library Netapi32.lib.
But I really don't know how to link a library.
Any help is appreciated.


Report Offensive Message For Removal


Response Number 1
Name: egkenny
Date: January 30, 2004 at 17:00:54 Pacific
Reply: (edit)

Select Project
Select Settings
Select Link tab
Select Input Category

The libraries are listed here:
"Object/library modules"

If necessary additional paths can be added here:
"Additional library paths"


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you own an iPhone?

Yes
No, but soon
No


View Results

Poll Finishes In 6 Days.
Discuss in The Lounge
Poll History




Data Recovery Software