Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › c++ errors. passing a pointer
New Posts  All Forums:Forum Nav:

c++ errors. passing a pointer

post #1 of 10
Thread Starter 
Hello, Im writing a program but when I try to pass a pointer to a function I get errors in syntax. Here is a what is not working.

from gameList.h Which holds class gameList
class gameList
{
public:
gameList(); // the constructor
void push(game*); // used to insert data to the list
void pop(string title); // used to remove data
void print(); // used to print out the list
game *top; // points to the list
void populate(); // used to populate list from an external db
void dump(); // used to dump the current structure to a db
fileIO fileOperations; // used to interact with the db
};

void gameList:ush(game *p)
{
game *temp;
temp = top;

while(temp->next != NULL)
temp = temp->next; // Move forward

// Insert the new node
temp->next = p;

dump(); // update the text db
}

application.h
class application
{
private:
gameList gList;
wishList wList;


when I run
gList.push(temp1); from application.cpp
temp1 is underlined in red in Visual Studio 2010. the error says argument type of game * is not compatible with parameter game *. it is really confusing.

this is what I am trying to pass
game *temp1;
temp1 = new game;


thanks

thanks
Edited by donkru - 3/3/11 at 10:35pm
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
post #2 of 10
i believe the problem is how you declare temp1. its declared as a pointer but you cant assign a game object to it directly. i think what you want is something like this:

Code:
game g = new game;
game *temp1 = &g;
i also believe the * should be changed to & like this
Code:
void gameList:ush(game &p)
an excellent reference regards to pointers http://www.cplusplus.com/doc/tutorial/pointers/
Edited by travesty - 3/3/11 at 11:25pm
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
post #3 of 10
Please copy and paste the entire error code...

Is game a structure or a class?

void push(game*); is valid, there is no need to use & that is to pass by reference, you are using pointers which is fine, and if you change it to the ampersand you are going to break other code that access this method as well.

Please copy and paste your error codes.
post #4 of 10
Thread Starter 
ok, still having that issue but also having a crap load of others. Heres the code

application.h
Code:
// application.h
// 2-22-2011
/*This will control the application.
*/

/* CHANGELOG
*/
#include "gameList.h"
#include "wishList.h"
#include "playList.h"
#define APPLICATION_H
#ifdef APPLICATION_H

class application
{
private:
bool applicationState;
gameList gList;
wishList wList;
playList pList;
public:
application();// The main constructor
// This will initiate mainMenu()
// and start the application
//

int mainMenu();// The main menu
//
//
//

bool appContinue(); // Controlls when the application exits
//
//
//

void appOption(int option); // Controlls which functions are launched bassed on user input
//
//
//
void addNodeGameList(); // Used to allow user to add a node to the list
//
//
//
void addNodeWishList(); // used to add a node to the whish list
//
//
//
void addNodePlayList(); // used to add a node to the play list

void popNodeGameList();
void popNodeWishList();
void popNodePlayList();

void viewAllList();
};



#endif // USERINTERFACE_H
gme.h
Code:
// gme.h
// structure for each game

#include <string>
using namespace std;

#define GME_H
#ifdef GME_H
struct gme
{
string tittle;
// This is were the name of the game goes
string genre;
// this is where the type of game goes
string developer;
//Put the developer name here
string serial;
// The serial number of the game
string beaten;
// Whether or not the game has been beaten
int priority;
// how important is the game to you. 1 is highest
string media;
// stae is the game is phisical or digitaldownload:
// Example: RetailCD, Steam, Direct2Drive, serialScan.
gme *next;
// used to link to the next game in the list
};
#endif // GME_H
gameList.h
Code:
// gameList.h
// 3-2-2011
/*This will be used for managing our games library
*/
#include <string>
#include "gme.h"
using std::string;

#define GAMELIST_H
#ifdef GAMELIST_H

class gameList
{
public:
gameList(); // the constructor
void push(gme*); // used to insert data to the list
int pop(string title); // used to remove data
void print(); // used to print out the list
gme *top; // points to the list
void populate(); // used to populate list from an external db
void dump(); // used to dump the current structure to a db
//fileIO fileOperations; // used to interact with the db
};

#endif // GAMELIST_H
playList.h
Code:
// playlist.h
// This is a stack of games

#include <string>
#include "gme.h"
using std::string;

#define PLAYLIST_H
#ifdef PLAYLIST_H

class playList
{
public:
playList(); // the constructor
void push(gme*); // used to insert data to the stack
void pop(); // used to remove data
void print(); // used to print out the stack
gme *top; // points to the stack
void populate(); // used to populate stack from an external db
void dump(); // used to dump the current structure to a db
//fileIO fileOperations; // used to interact with the db
};

#endif // PLAYLIST_H
wishList.h
Code:
// wishlist.h
// This is a queue of games

#include <string>
#include "gme.h"
using std::string;

#define WISHLIST_H
#ifdef WISHLIST_H

class wishList
{
public:
wishList(); // the constructor
void push(gme*); // used to insert data to the queue
void pop(); // used to remove data
void print(); // used to print out the queue
gme *top; // points to the queue
void populate(); // used to populate queue from an external db
void dump(); // used to dump the current structure to a db
//fileIO fileOperations; // used to interact with the db
};

#endif // WISHLIST_H
application.cpp
Code:
#include <iostream>
#include <string>
#include <cctype>
#include "application.h"

using namespace std;

application::application() // Constructor
{
applicationState = true;
// Set the application to running
gList.populate();
wList.populate();
pList.populate();
}

int application::mainMenu()
{
char input;
// this is the main menu
cout << "\
Welcome to Game Library and Wish List manager!";
cout << "\
Make a choice from the options below!";
cout << "\
A:: Add a game to Game Library";
cout << "\
B:: Remove a game from the Game Library";
cout << "\
C:: Add a game to the Wish List";
cout << "\
D:: Remove a game from the Wish List";
cout << "\
E:: Add a game to the Play List";
cout << "\
F:: Remove a game from the Play List";
cout << "\
G:: View the list";
cout << "\
H:: Exit the application";
cout << "\
Make a selection :: ";
cin >> input;

input = toupper(input);

switch(input)
{
case 'A':
return 1; // return option 1
break;
case 'B':
return 2; // option 2
break;
case 'C':
return 3; // option 3
break;
case 'D':
return 4; // option 4
break;
case 'E':
return 5;
break;
case 'F':
return 6;
break;
case 'G':
return 7;
break;
case 'H':
return 8;
break;
default:
cout << "\
Make a valid choice please, Try again!";
break;

}

}

bool application::appContinue()
{
return applicationState;
}

void application::appOption(int op)
{
switch(op)
{
case 1:
addNodeGameList();
break;
case 2:
popNodeGameList();
break;
case 3:
addNodeWishList();
break;
case 4:
popNodeWishList();
break;
case 5:
addNodePlayList();
break;
case 6:
popNodePlayList();
break;
case 7:
viewAllList();
break;
case 8:
applicationState = false;
break;
}
}

void application::addNodeGameList()
{
// this will ask user for input to add nodes to the game list
cout << "\
Lets begin with some ground rules!";
cout << "\
The first rule is. DON'T use the space bar, EVER!. It will cause issues.";
cout << "\
Instead of a space bar input _(underscore) by hitting Shift and -.";
cout << "\
Lets Begin!\
";
system("CLS");

//create some cariales to hold the data
gme *temp1;
temp1 = new gme;
string stringInput1;
int intInput1;

cout << "\
What is the name of the game? ";
cin >> stringInput1;
temp1->tittle = stringInput1;

cout << "\
What is the genre of this game? ";
cin >> stringInput1;
temp1->genre = stringInput1;

cout << "\
Who developed this game? ";
cin >> stringInput1;
temp1->developer = stringInput1;

cout << "\
What is the serial number of this game? just put 000 if you dont have one! ::";
cin >> stringInput1;
temp1->serial = stringInput1;

cout << "\
Have you beaten this game? Yes or No?: ";
cin >> stringInput1;
temp1->beaten = stringInput1;

cout << "\
How important is this game to you? Input a number, The lower the number the higher the priority!::";
cin >> intInput1;
temp1->priority = intInput1;

cout << "\
What kind of media is this game on? Ex. Retail CD, Steam, Direct2Drive, Serial Scan?:: ";
cin >> stringInput1;
temp1->media = stringInput1;

temp1->next = NULL;
// Now we push this into the list!
gList.push(temp1);

cout << "\
Done, Game added to list. Hit Enter to continue!";
cin.get();
system("CLS");

}

void application::addNodeWishList()
{
// this will ask user for input to add nodes to the game list
cout << "\
Lets begin with some ground rules!";
cout << "\
The first rule is. DON'T use the space bar, EVER!. It will cause issues.";
cout << "\
Instead of a space bar input _(underscore) by hitting Shift and -.";
cout << "\
Lets Begin!\
";
system("CLS");

//create some cariales to hold the data
gme *temp1;
temp1 = new gme;
string stringInput1;
int intInput1;

cout << "\
What is the name of the game? ";
cin >> stringInput1;
temp1->tittle = stringInput1;

cout << "\
What is the genre of this game? ";
cin >> stringInput1;
temp1->genre = stringInput1;

cout << "\
Who developed this game? ";
cin >> stringInput1;
temp1->developer = stringInput1;

temp1->serial = "HOLDER";

temp1->beaten = "HOLDER";

temp1->priority = 0;

temp1->media = "HOLDER";

temp1->next = NULL;
// Now we push this into the list!
wList.push(temp1);

cout << "\
Done, Game added to list. Hit Enter to continue!";
cin.get();
system("CLS");

}

void application::addNodePlayList()
{
// this will ask user for input to add nodes to the game list
cout << "\
Lets begin with some ground rules!";
cout << "\
The first rule is. DON'T use the space bar, EVER!. It will cause issues.";
cout << "\
Instead of a space bar input _(underscore) by hitting Shift and -.";
cout << "\
Lets Begin!\
";
system("CLS");

//create some cariales to hold the data
gme *temp1;
temp1 = new gme;
string stringInput1;
int intInput1;

cout << "\
What is the name of the game? ";
cin >> stringInput1;
temp1->tittle = stringInput1;

cout << "\
What is the genre of this game? ";
cin >> stringInput1;
temp1->genre = stringInput1;

cout << "\
Who developed this game? ";
cin >> stringInput1;
temp1->developer = stringInput1;

temp1->serial = "HOLDER";

temp1->beaten = "HOLDER";

temp1->priority = 0;

temp1->media = "HOLDER";

temp1->next = NULL;
// Now we push this into the list!
pList.push(temp1);

cout << "\
Done, Game added to list. Hit Enter to continue!";
cin.get();
system("CLS");

}

void application::popNodeGameList()
{
string input;
bool done = false;

cout << "\
This will guide you to remove a game from the game list!";

while(done == false)
{
cout << "\
Which game do you wan to remove? Tell me the name! ";
cin >> input;
if(gList.pop(input) == 1)
done = true;
else
cout << "\
Tru Again!, Game not found, Check spelling!";
}
}

void application::popNodeWishList()
{
string input;
bool done = false;

cout << "\
This will guide you to remove a game from the wish list!";

while(done == false)
{
cout << "\
Are you sure you want to remove " << wList.top->tittle << "from the wish list? Y or N";
cin >> input;
if(input == "Y")
{
wList.pop();
done = true;
cout << "\
Game removed!";
}
else if(input == "N")
{
cout << "\
Aborting!";
done = true;
}
else
cout << "\
Tru Again!, make a valid choice!";
}
}

void application::popNodePlayList()
{
string input;
bool done = false;

cout << "\
This will guide you to remove a game from the wish list!";

while(done == false)
{
cout << "\
Are you sure you want to remove " << pList.top->tittle << "from the wish list? Y or N";
cin >> input;
if(input == "Y")
{
wList.pop();
done = true;
cout << "\
Game removed!";
}
else if(input == "N")
{
cout << "\
Aborting!";
done = true;
}
else
cout << "\
Tru Again!, make a valid choice!";
}
}

void application::viewAllList()
{
cout << "\
I am going to show you each list, One at a time, Hit enter to see the next list!";
cout << "\
Here is your Game List!" << endl;

gList.print();

cout << "\
Press ENTER to see next list!";
cin.get();

cout << "\
Here is your Wish List!" << endl;

wList.print();

cout << "\
Press ENTER to see next list!";
cin.get();

cout << "\
Here is your Play List!" << endl;

pList.print();

cout << "\
Thats it. Press ENTER to go back to the menu!";
cin.get();
}
gameList.cpp
Code:
#include <iostream>
#include <string>
#include "gameList.h"
using namespace std;

gameList::gameList()
{
top = NULL;
}

void gameList::push(gme *p)
{
gme *temp;
temp = top;

while(temp->next != NULL)
temp = temp->next; // Move forward

// Insert the new node
temp->next = p;

dump(); // update the text db
}

int gameList::pop(string gameTittle)
{
//This will remove a node from the list and fix the list
bool inserted = false;
gme *temp1, *temp2;
temp1 = top;

// check to see if the one that needs to be removed is at the top of the list
if(temp1->tittle == gameTittle)
{
temp2 = top; // assign top to temp2
top = temp1->next; // fix the list
delete temp2; // remove the node
inserted = true; // set inserted as true
}

// we need to look through the list now
if(inserted != true)
{
while(temp1->tittle != gameTittle)
{
if(temp1->next->tittle == gameTittle)
temp2 = temp1;// set temp2 to the previous of the node will will work with
temp1 = temp1->next;
}
temp2->next = temp1->next; // fix list
delete temp1; // delete the node
inserted = true;
}

if(inserted == true)
{
cout << "\
Game removed!";
dump(); // update the text db
return 1;
}
else
{
cout << "\
Game not removed. Check spelling and try again!";
return 0;
}

}

void gameList::print()
{
// this will display all of the nodes in the list
gme *temp1; // this will cycle us through
temp1 = top;
cout << endl;

while(temp1 != NULL)
{
cout << "*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_";
cout << 
"\
Tittle: " << temp1->tittle <<
"\
Genre: " << temp1->genre <<
"\
Developer: " << temp1->developer <<
"\
Serial: " << temp1->serial <<
"\
Game Beated: " << temp1->beaten <<
"\
Priority: " << temp1->priority <<
"\
Media: " << temp1->media;
temp1 = temp1->next;
}
dump(); // update the text db
}

void gameList::populate()
{
/*/ used to read in from a db
game *temp1, *temp2;
temp1 = top;
temp1 = fileOperations.gameReadAll();

while(temp2 != NULL)
{
temp1 = temp2; //assign the data
temp1 = temp1->next; // move forward
}
*/
}

void gameList::dump()
{
/*/ this dumps the contents of the list to an external db
if(fileOperatioms.gameDump(top) != true)// pass the list along
{
cout << "\
Error dumping contents. Something happend on yuour end!";
}
*/
}
playList.cpp
Code:
#include <iostream>
#include <string>
#include <cctype>
#include "playList.h"
using namespace std;

playList::playList()
{
top = NULL;
}

void playList::push(gme *p)
{
gme *temp;
temp = top;


// Insert the new node
top = p;
top->next = temp;

dump(); // update the text db
}

void playList::pop()
{
//This will remove a node from the list and fix the list
gme *temp1;
temp1 = top;

cout << "\
I will remove " << temp1->tittle << " from the play list!";

top = temp1->next;
delete temp1;

dump(); // update the text db
}

void playList::print()
{
// this will display all of the nodes in the list
gme *temp1; // this will cycle us through
temp1 = top;
cout << endl;

while(temp1 != NULL)
{
cout << "*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_";
cout << 
"\
Tittle: " << temp1->tittle <<
"\
Genre: " << temp1->genre <<
"\
Developer: " << temp1->developer;
temp1 = temp1->next;
}

}

void playList::populate()
{
/*/ used to read in from a db
game *temp1, *temp2;
temp1 = top;
temp2 = fileOperations.playReadAll();

while(temp2 != NULL)
{
temp1 = temp2; //assign the data
temp1 = temp1->next; // move forward
}
*/
}

void playList::dump()
{
/*/ this dumps the contents of the list to an external db
if(fileOperatioms.playDump(top) != true)// pass the list along
{
cout << "\
Error dumping contents. Something happend on yuour end!";
}
*/
}
wishList.cpp
Code:
#include <iostream>
#include <string>
#include <cctype>
#include "wishList.h"
using namespace std;

wishList::wishList()
{
top = NULL;
}

void wishList::push(gme *p)
{
gme *temp;
temp = top;

while(temp->next != NULL)
temp = temp->next; // Move forward

// Insert the new node
temp->next = p;

dump(); // update the text db
}

void wishList::pop()
{
//This will remove a node from the list and fix the list
gme *temp1;
temp1 = top;

cout << "\
I will remove " << temp1->tittle << " from the wish list!";

top = temp1->next;
delete temp1;

dump(); // update the text db
}

void wishList::print()
{
// this will display all of the nodes in the list
gme *temp1; // this will cycle us through
temp1 = top;
cout << endl;

while(temp1 != NULL)
{
cout << "*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_";
cout << 
"\
Tittle: " << temp1->tittle <<
"\
Genre: " << temp1->genre <<
"\
Developer: " << temp1->developer;
temp1 = temp1->next;
}

}

void wishList::populate()
{
/*/ used to read in from a db
game *temp1, *temp2;
temp1 = top;
temp2 = fileOperations.wishReadAll();

while(temp2 != NULL)
{
temp1 = temp2; //assign the data
temp1 = temp1->next; // move forward
}
*/
}

void wishList::dump()
{
/*
// this dumps the contents of the list to an external db
if(fileOperatioms.wishDump(top) != true)// pass the list along
{
cout << "\
Error dumping contents. Something happend on yuour end!";
}
*/
}
errors:

Code:
1>Build started 3/4/2011 12:38:23 PM.
1>InitializeBuildStatus:
1>  Touching "Debug\\CS220_Final.unsuccessfulbuild".
1>ClCompile:
1>  application.cpp
1>c:\\users\\eric\\documents\\visual studio 2010\\projects\\cs220_final\\cs220_final\\gme.h(10): error C2011: 'gme' : 'struct' type redefinition
1>          c:\\users\\eric\\documents\\visual studio 2010\\projects\\cs220_final\\cs220_final\\gme.h(10) : see declaration of 'gme'
1>c:\\users\\eric\\documents\\visual studio 2010\\projects\\cs220_final\\cs220_final\\application.cpp(117): error C2027: use of undefined type 'gme'
1>          c:\\users\\eric\\documents\\visual studio 2010\\projects\\cs220_final\\cs220_final\\gme.h(10) : see declaration of 'gme'
1>c:\\users\\eric\\documents\\visual studio 2010\\projects\\cs220_final\\cs220_final\\application.cpp(117): fatal error C1903: unable to recover from previous error(s); stopping compilation
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.20
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any help is much appreciated.
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
post #5 of 10
i think you need to include gme.h in application.cpp. the compiler doesnt know what gme is.
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
Fractal Design
(15 items)
 
775 4 life
(15 items)
 
 
CPUMotherboardGraphicsRAM
Intel i7 2600K Biostar TP67XE NVidia GTX 570 Crucial Ballistix 
Hard DriveHard DriveCoolingOS
Crucial C300 RealSSD SDD Samsung F4 2TB Noctua NH-D14 Windows 7 Professional x64 
MonitorMonitorKeyboardPower
Asus VH202T 20'' 1600x900 Acer P244W 24" 1920 x 1080 Apple Keyboard with Numeric Keypad SeaSonic M12II 620W 
CaseMouseAudio
Fractal Design Define XL Titanium Grey Razor Abyssus Creative Sound Blaster X-FI Xtreme Gamer 
CPUMotherboardGraphicsRAM
Intel X3350 3.2Ghz @ 1.25v Gigabyte-GA-P35-DS3L (rev 2) XFX 4870 1GB 4GB OCZ Reaper PC2-6400 
RAMHard DriveHard DriveOptical Drive
2GB Corsair XMS2 PC2-6400 Crucial C300 64GB SSD 2TB Samsung Spinpoint F4 Sony Super Multi 
OSMonitorPowerCase
Windows 7 Professional x64 SP1 Asus VH202T 20'' 1600x900 SeaSonic M12II 620W Cooler Master Centurion 5 
Mouse
Razor Abyssus 
CPUMotherboardGraphicsRAM
Core i5-520M Lenovo 2522BF3 NVIDIA® Quadro® NVS3100M  Ramaxel Technology 4Gb DDR3 
Hard DriveOptical DriveOSMonitor
Samsung SSD 128GB 1.8" Micro SATA  hl-dt-st dvdram gu10n Windows 7 Enterprise (64-bit) 14.1" WXGA (1280x800) display, anti-glare, LED ... 
Power
9-cell plus Slice battery 
  hide details  
Reply
post #6 of 10
Thread Starter 
application.cpp Headers
Code:
#include <iostream>
#include <string>
#include <cctype>
#include "gme.h"
#include "application.h"

Errors
Code:
1>------ Build started: Project: CS220_Final, Configuration: Debug Win32 ------
1>Build started 3/4/2011 1:22:13 PM.
1>InitializeBuildStatus:
1>  Touching "Debug\\CS220_Final.unsuccessfulbuild".
1>ClCompile:
1>  application.cpp
1>c:\\users\\eric\\documents\\visual studio 2010\\projects\\cs220_final\\cs220_final\\gme.h(10): error C2011: 'gme' : 'struct' type redefinition
1>          c:\\users\\eric\\documents\\visual studio 2010\\projects\\cs220_final\\cs220_final\\gme.h(10) : see declaration of 'gme'
1>c:\\users\\eric\\documents\\visual studio 2010\\projects\\cs220_final\\cs220_final\\application.cpp(118): error C2027: use of undefined type 'gme'
1>          c:\\users\\eric\\documents\\visual studio 2010\\projects\\cs220_final\\cs220_final\\gme.h(10) : see declaration of 'gme'
1>c:\\users\\eric\\documents\\visual studio 2010\\projects\\cs220_final\\cs220_final\\application.cpp(118): fatal error C1903: unable to recover from previous error(s); stopping compilation
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.49
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
post #7 of 10
Are you initializing the gme object correctly?

Code:
gme *temp1;
temp1 = new gme;
Shouldn't it be temp1 = new gme();
post #8 of 10
What is "gme" supposed to be? Did you perhaps misspell "game"?
Underground
(14 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 920 C0 ASUS P6T6 WS Revolution GTX 460 TR3X6G1600C8D 
Hard DriveOptical DriveCoolingOS
WD1001FALS SAMSUNG SH-S223F 22X DVD MULTI Corsair H50 Fedora 16 KDE x86_64 
MonitorKeyboardPowerCase
HP w19b Microsoft Comfort Curve Corsair CX600 Thermaltake Armor VA8003BWS 
MouseMouse Pad
Razer DeathAdder Black 
  hide details  
Reply
Underground
(14 items)
 
  
CPUMotherboardGraphicsRAM
Core i7 920 C0 ASUS P6T6 WS Revolution GTX 460 TR3X6G1600C8D 
Hard DriveOptical DriveCoolingOS
WD1001FALS SAMSUNG SH-S223F 22X DVD MULTI Corsair H50 Fedora 16 KDE x86_64 
MonitorKeyboardPowerCase
HP w19b Microsoft Comfort Curve Corsair CX600 Thermaltake Armor VA8003BWS 
MouseMouse Pad
Razer DeathAdder Black 
  hide details  
Reply
post #9 of 10
Thread Starter 
I have tried playing around with different things but for some reason i cant do anything to fix it.
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
post #10 of 10
Thread Starter 
Update!. I got it fixed. I was doing things a little wrong i was doing

#define
#ifdef
#endif

I had to do
#ifndef
#define
#endif

Everything worked like a charm.Just some minor tweaks to the logic of it and now it is working great. Thanks for the help!
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › c++ errors. passing a pointer