User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 374,446 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,753 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 7064 | Replies: 2 | Solved
Reply
Join Date: Jun 2004
Location: Albany, Georgia
Posts: 12
Reputation: moznmar is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
moznmar's Avatar
moznmar moznmar is offline Offline
Newbie Poster

Help LNK2019 Error

  #1  
Jan 22nd, 2006
I've been trying to get this code to build, but I keep receiving the following errors:

week5Crook.obj : error LNK2019: unresolved external symbol "void __cdecl decrypt(char *)" (?decrypt@@YAXPAD@Z) referenced in function _main
week5Crook.obj : error LNK2019: unresolved external symbol "void __cdecl encrypt(char *)" (?encrypt@@YAXPAD@Z) referenced in function _main
Debug/week5Crook.exe : fatal error LNK1120: 2 unresolved externals

The program compiles fine and I haven't been able to figure out exactly what this error is trying to tell me. I was able to build and run this program in Dev C++, but I'm now getting these errors when I try to build this program in VS .Net 2003. Any guidance you may be able to provide would be greatly appreciated.

#include <iostream>

using namespace std;

void encrypt(char *);
void decrypt(char *);

int main()
{
    char string[] = "This is a secret!";

    cout << "Encrypted string is: ";
    encrypt(string);

	cout << "\nDecrypted string is: ";
    decrypt(string);

    cout << endl << endl;

    return 0;
}//end main()

//encrypts string by adding 1 to the value of each character
void encrypt(char *sPtr)
{
     while (*sPtr != '\0')    //exit while at null character
     {
           *sPtr += 1;
           cout << *sPtr;
           ++sPtr;
     }//end while
}//end encrypt()

//decrypts string by subtracting 1 to the value of each character
void decrypt(char *sPtr)
{
     while (*sPtr != '\0')//exit while at null character
     {
           *sPtr -= 1;
           cout << *sPtr;
           ++sPtr;
     }//end while
}//end decrypt()
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2004
Posts: 6,008
Reputation: Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of 
Rep Power: 26
Solved Threads: 409
Super Moderator
Narue's Avatar
Narue Narue is offline Offline
Expert Meanie

Re: LNK2019 Error

  #2  
Jan 22nd, 2006
It sounds like you have a building issue rather than a code issue. It links and runs just fine for me on Visual Studio .NET 2003. Try making a new project and pasting your code into it, then let us know if it worked or not.
Member of: Beautiful Code Club.
Reply With Quote  
Join Date: Jun 2004
Location: Albany, Georgia
Posts: 12
Reputation: moznmar is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
moznmar's Avatar
moznmar moznmar is offline Offline
Newbie Poster

Re: LNK2019 Error

  #3  
Jan 22nd, 2006
That worked. Thank you so much. I can't believe I wasted so much time trying to figure out something which had such a simple solution. Actually, yes I can.

I appreciate it, Narue.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C++ Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 12:34 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC