Sign in to follow this  
JonBMN

SafeCracker program help!

Recommended Posts

JonBMN    738
program..
[CODE]
// learn.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include "safestuff.cpp"
#include "SafeCracker.cpp"
#include <string>
using namespace std;
int main()
{
cout << "Suprise, suprise!" << endl;
cout << "The combination is (once again)" <<endl;
cout << SafeCracker(12)<<endl;
system("pause");

return 0;
}
[/CODE]

safestuff.cpp

[CODE]
#include "stdafx.h"
#include <string>
using namespace std;
#ifndef SAFESTUFF_H_INCLUDED
#define SAFESTUFF_H_INCLUDED
string SafeCracker(int SafeID);
#endif // SAFESTUFF_H_INCLUDED
[/CODE]

SafeCracker.cpp

[CODE]
#include "stdafx.h"
#include <string>
using namespace std;
string SafeCracker(int SafeID)
{
return "13-26-16";
}
[/CODE]

This is the error code I do not understand, if you could help me out it would be much appreciated!

1>------ Build started: Project: learn, Configuration: Debug Win32 ------
1>SafeCracker.obj : error LNK2005: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl SafeCracker(int)" (?SafeCracker@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) already defined in learn.obj
1>C:\Users\JonBecher\documents\visual studio 2012\Projects\learn\Debug\learn.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this