LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-25-2005, 11:40 PM   #1
purefan
Member
 
Registered: Aug 2003
Location: Sweden
Distribution: Ubuntu 10.04
Posts: 99

Rep: Reputation: Disabled
error: unresolved external symbol


hello!
well im writting a Wallet program, basically (as it is) the user is suposed to be able to add expenses, incomes (both with comments) and the program keeps a record of when you spent and how much and in what. It is a self proyect, just for the love to art
Please remember that not all the functions are complete since im stuck with the storing to char[] ProfileInUse
Im using VC++6 under Windows XP Professional.
The linker returns:
Contador.obj : error LNK2001: unresolved external symbol "private: static char * Wallet::ProfileInUse" (?ProfileInUse@Wallet@@0PADA)
I read the MSDN about the number of the problem but was not able to solve this issue...
well here is the code:
Code:
// Wallet.cpp
#include "contador.h"
#include <stdlib.h>
#include <stdio.h>

int main()
{
Wallet::Menu();
	return 0;
}

// EOF Wallet.cpp
Code:
// Wallet.h
#include <fstream.h>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <windows.h>

/*
Menu options and 'manual':
1. First user must create a profile
2. User must open a profile
3. User can add expenses, incomes, show balance
4. User can exit the program (it closes the profile/session by itself)

	-Creation of a Profile
		The program creates a file
	- Opening of a profile
		Opens the respective file and adds to InUse[] the name of the profile being used
	- Adding of information
		Knowing which profile is being used the program adds +INTEGER/COMMENT/ or -INTEGER/COMMENT/
  


*/


class Wallet
{

	public:
		static void Create_Profile(char b[]);	
		static void Erase_Profile(char c[]);

		void CerrarProfile();		
		void AddExpense(int);		
		void AddIncome(int);	
		void ShowBalance();	
		void CalculateBalance();
		void OpenProfile();	
		static void Menu();
		

	private:
		int Incomes[50];
		static char ProfileInUse[20];


};

void Wallet::Create_Profile(char a[])
{
	WIN32_FIND_DATA FindFileData;
	HANDLE hFind;
	system("cls");
	printf ("Checking for duplication of file:  %s.\n", a);
	hFind = FindFirstFile(a, &FindFileData);
	if (hFind == INVALID_HANDLE_VALUE) 
  {
	  
	  cout << "The profile does not exist yet.\nProceeding to create it:\n";
	  ofstream Profile(a);
	  Profile.close();
	  cout << "....\nProfile succesfully created!\n\n";


  } 
  else 
  {
	   cout << "Imposible to create the new profile, Name already exists.\n";
       FindClose(hFind);
   
  }

}



void Wallet::Erase_Profile(char c[])
{

system("cls");
cout << "You are about to delete " << c << ".\nContinue?\n";
char question1;
cout << "Enter 'y' for yes | Enter 'n' for No";
cin >> question1;
if (question1 == 's') 
	{
		if ( remove(c) == -1)
			perror ("\nA problem occured and the profile was NOT deleted\n");
		else ( puts("\nProfile succesfully deleted\n"));
	}

}//Wallet::Erase_Profile

void Wallet::Menu()
{
//	system("cls");

		for (int i = 0; i < 20; i++){
			ProfileInUse[i] = '\0';
		}

	cout << "\t-Menu-\n";
	cout << "1.Open Profile\n";
	cout << "2.Create Profile\n3.Erase Profile\n";

int Men;
cin >> Men;

switch(Men)
	{
case 1:
	cout << "Enter the name of the profile";
Here is "where" the problem occurs:
Code:
cin >> ProfileInUse;
	
	break;
case 2: char Name[10];
		cout << "Create Profile.\n Write a Name for the new profile (10 characters max)\n";
		cin.getline(Name,10);// >> Name;
		//cin.getline(Name,10);
		Wallet::Create_Profile(Name);
		Wallet::Menu();
		break;
case 3:char NameErase[10];
	cout << "What profile do you wish to Erase?\n";
	cin.getline(NameErase,10);// >> NameErase;
	//cin.getline(NameErase,10);
	Wallet::Erase_Profile(NameErase);
	Wallet::Menu();
	break;
	}//switch

}// EOF wallet.h
Any idea of what the problem actually is?? how to fix it???
Anyway thanks for taking the time
 
Old 03-26-2005, 02:42 AM   #2
ahwkong
Member
 
Registered: Aug 2004
Location: Australia
Distribution: Fedora
Posts: 282

Rep: Reputation: 30
Add this line to wallet.cpp

char Wallet::ProfileInUse[20] = "";

You can initialise it to anything you like, actually.
 
Old 03-26-2005, 07:10 AM   #3
purefan
Member
 
Registered: Aug 2003
Location: Sweden
Distribution: Ubuntu 10.04
Posts: 99

Original Poster
Rep: Reputation: Disabled
YAAAHOOO!!!!! (or google if you prefer)
Thanks!!! =D
believe it or not I had spent just about one week trying to get this right...I feel dumb
anyways it worked. thanks a lot!
 
Old 03-26-2005, 07:27 AM   #4
ahwkong
Member
 
Registered: Aug 2004
Location: Australia
Distribution: Fedora
Posts: 282

Rep: Reputation: 30
No worries.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unresolved symbol htons mintong Linux - Software 4 08-03-2005 09:53 PM
unresolved symbol haddon Linux - Hardware 3 03-11-2005 02:24 PM
Unresolved symbol? Elonch Programming 2 03-01-2005 11:48 PM
unresolved symbol error/ acx100_pci.o module sahil1 Linux - Hardware 0 03-12-2004 12:32 AM
SB Audigy Unresolved Symbol Metal Linux - Hardware 2 10-16-2002 07:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration