Archived

This topic is now archived and is closed to further replies.

3dmodelerguy

linking error

Recommended Posts

3dmodelerguy    160
well i have a new problem, here is my new code:
#include <iostream>
#include <string>
#include <conio.h>

using namespace std;

char choose;

class Stock
{
	
	public:
		
		Stock( string = null, char = ''\O'', int = 0, int = 0);
		void StockNew( string *, char, int, int );

	private:
		
		string name;
		char type;
		int indexnumber;
		int value;
		
};

void Stock::StockNew( string *namePtr, char typeS, int indexnumberS, int valueS)
{ 

	name = *namePtr;
	type = typeS;
	indexnumber = indexnumberS;
	value = valueS;

}

int main()
{
	
	string newname;
	char newtype;
	int newindexnumber;
	int newvalue;

	cout << "Enter the data in the following order with space to seperate them(name, type, indexnumber, value)\n: ";
	cin >> newname >> newtype >> newindexnumber >> newvalue;
	Stock test;
	test.StockNew( &newname, newtype, newindexnumber, newvalue);
	cout << "data entered, thank you\n";
	getch();

	cout << "Welcome to the game";

	return 0;
	
}


and here are my errors:

   
Deleting intermediate files and output files for project ''string test - Win32 Release''.
Deleting intermediate files and output files for project ''string test - Win32 Debug''.
--------------------Configuration: string test - Win32 Release--------------------
Compiling...
string test.cpp
Linking...
string test.obj : error LNK2001: unresolved external symbol "public: __thiscall Stock::Stock(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,int,int)" (??0Stock@@QAE@V?$basic_string@DU?$char_traits@D@std@
@V?$allocator@D@2@@std@@DHH@Z)
Release/string test.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

string test.exe - 2 error(s), 0 warning(s)
--------------------Configuration: string test - Win32 Debug--------------------
Compiling...
string test.cpp
Linking...
string test.obj : error LNK2001: unresolved external symbol "public: __thiscall Stock::Stock(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char,int,int)" (??0Stock@@QAE@V?$basic_string@DU?$char_traits@D@std@
@V?$allocator@D@2@@std@@DHH@Z)
Debug/string test.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

string test.exe - 2 error(s), 0 warning(s)
doest this have anything to do with me have the string in the parameter for the constructor and StockNew? if not, what are this errors? [edited by - 3dmodelerguy on March 21, 2004 4:47:55 PM]

Share this post


Link to post
Share on other sites