link error

Posted on 2003-03-28
Medium Priority
Last Modified: 2010-04-01
Below is my program and I am getting linking errors.  They are listed below as well.  
I know that it is something small and overlooked but please help me out.  Thank you.

#include "cppvm.h"
int main()
  // connect to pvm
     cppvmConnection pvmConn;
  // send descriptor
  // (blocking send
  //  to parent process)
  cppvmSendStream sendStrm(pvmConn,
  // message
  cppvmString sendMsg("hello world!");
  // send message
  sendStrm << sendMsg;

  return 0;

LINK : warning LNK4044: unrecognized option "nodefaultlibrary:libcd"; ignored
hello2.obj : error LNK2001: unresolved external symbol "public: __thiscall cppvmConnection::cppvmConnection(void)" (??0cppvmConnection@@QAE@XZ)
hello2.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall cppvmConnection::~cppvmConnection(void)" (??1cppvmConnection@@UAE@XZ)
hello2.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall cppvmSendStream::~cppvmSendStream(void)" (??1cppvmSendStream@@UAE@XZ)
hello2.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall cppvmString::~cppvmString(void)" (??1cppvmString@@UAE@XZ)
hello2.obj : error LNK2001: unresolved external symbol "public: __thiscall cppvmString::cppvmString(char *)" (??0cppvmString@@QAE@PAD@Z)
hello2.obj : error LNK2001: unresolved external symbol "public: __thiscall cppvmSendStream::cppvmSendStream(class cppvmConnection &,enum cppvmSendConnection,int)" (??0cppvmSendStream@@QAE@AAVcppvmConnection@@W4cppvmSendConnection@@H@Z)
hello2.obj : error LNK2001: unresolved external symbol "public: void __thiscall cppvmObject::cppvmSend(class cppvmSendStream &)" (?cppvmSend@cppvmObject@@QAEXAAVcppvmSendStream@@@Z)
Debug/hello2.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.
Question by:silverFox
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 12

Accepted Solution

Salte earned 300 total points
ID: 8227993
You didn't link the library that you should include to call the functions and stuff defined in that include file. You include the #include file but didn't tell the linker to include the .lib file.

When you do #include "foo.h" you just tell the compiler that there are some functions and methods available somewhere and the arguments etc to them. The #include "foo.h" does not magically cause those functions to be defined. They are defined when the linker links the corresponding foo.lib file.

Change your makefile or project file to include the library that comes with that include file "cppvm.h"


Expert Comment

ID: 8230058
Assuming cppvm.cpp is the file that contains the definition of the functions that you are calling, add either the lib in which cppvm.cpp is included(if one exists) or add cppvm.cpp directly into your project. Both ways the linker would find the function definitions.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question