• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
JonBMN

Embedded Help!

9 posts in this topic

I'm creating a class for a later program called EthicalCompetition. I'm stuck on an error code and don't truely understand the meaning of it, if anyone could help me out I would be very appreciated.

[CODE]
#include "stdafx.h"
#include <iostream>
using namespace std;
class EthicalCompetition
{
private:
class Connection;
public:
void HardWork();
};
class EthicalCompetition::Connection{
protected:
friend class EthicalCompetition;
void Connect();
Connection() {}
~Connection() {}
};
void EthicalCompetition::HardWork()
{
Connection c;
c.Connect();
cout << "Connected" << endl;
}
void EthicalCompetition::Connection::Connection()
{
cout << "Connecting..." << endl;
}
int main(int argc, char *argv[])
{
//EthicalCompetition::Connection myconnect;
EthicalCompetition comp;
comp.HardWork();
system("pause");
return 0;
}
[/CODE]

error code

1>------ Build started: Project: Tracing, Configuration: Debug Win32 ------
1> Tracing.cpp
1>c:\users\jonbecher\documents\visual studio 2012\projects racing racing racing.cpp(26): error C2533: 'EthicalCompetition::Connection::{ctor}' : constructors not allowed a return type
1>c:\users\jonbecher\documents\visual studio 2012\projects racing racing racing.cpp(26): error C2084: function 'EthicalCompetition::Connection::Connection(void)' already has a body
1> c:\users\jonbecher\documents\visual studio 2012\projects racing racing racing.cpp(16) : see previous definition of '{ctor}'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Edited by JonBMN
0

Share this post


Link to post
Share on other sites
As the error messages mention, you're trying to redefine EthicalCompetition::Connection::Connection(). You define it as an empty inline method in the class definition for it above.

Perhaps you meant for the second definition to be EthicalCompetition::Connection::Connect()?

If the horrible spacing isn't the board's fault, I highly suggest modern inventions like indentation. It's 2012, you can afford a tab or three in a file.
0

Share this post


Link to post
Share on other sites
[quote name='ReaperSMS' timestamp='1345224443' post='4970614']
As the error messages mention, you're trying to redefine EthicalCompetition::Connection::Connection(). You define it as an empty inline method in the class definition for it above.

Perhaps you meant for the second definition to be EthicalCompetition::Connection::Connect()?

If the horrible spacing isn't the board's fault, I highly suggest modern inventions like indentation. It's 2012, you can afford a tab or three in a file.
[/quote]
Could you explain a little further please.

And yes it is the board's fault, I suggest before being condescending you just help out and not assume. Thank you.
-1

Share this post


Link to post
Share on other sites
This is the relevant part of the code:
[CODE]
class EthicalCompetition::Connection{
protected:
friend class EthicalCompetition;
void Connect();
Connection() {} // this line defines EthicalCompetition::Connection::Connection as an empty default constructor
~Connection() {}
};
void EthicalCompetition::Connection::Connection() // this line attempts to redefine it as an invalid constructor
{
cout << "Connecting..." << endl;
}
[/CODE]
Constructors defined outside of classes do not have return types specified, this includes void. Your code snippet also neglected to define EthicalCompetition::Connection::Connect(), which makes me think that's what you meant to type for the function that prints "Connecting...".
0

Share this post


Link to post
Share on other sites
[quote name='JonBMN' timestamp='1345233041' post='4970651']
And yes it is the board's fault, I suggest before being condescending you just help out and not assume. Thank you.
[/quote]

Then why code snippet from ReaperSMS has spaces and it looks readable?
0

Share this post


Link to post
Share on other sites
[quote name='DoctorGlow' timestamp='1345235429' post='4970662']
[quote name='JonBMN' timestamp='1345233041' post='4970651']
And yes it is the board's fault, I suggest before being condescending you just help out and not assume. Thank you.
[/quote]

Then why code snippet from ReaperSMS has spaces and it looks readable?
[/quote]
It's how he put it into the code snippet program; mine came straight from the IDE and I put the [ code ] around it myself. Please do not come onto the forum to argue, this is a place for help. He gave his opinion I gave mine. Neither of us needs you to intervene on this matter, and since your neither helping nor posting for a good reason. I'd ask you to please not post on my topic trying to mediate.

Thank you.
0

Share this post


Link to post
Share on other sites
[quote name='ReaperSMS' timestamp='1345234830' post='4970658']
This is the relevant part of the code:
[CODE]
class EthicalCompetition::Connection{
protected:
friend class EthicalCompetition;
void Connect();
Connection() {} // this line defines EthicalCompetition::Connection::Connection as an empty default constructor
~Connection() {}
};
void EthicalCompetition::Connection::Connection() // this line attempts to redefine it as an invalid constructor
{
cout << "Connecting..." << endl;
}
[/CODE]
Constructors defined outside of classes do not have return types specified, this includes void. Your code snippet also neglected to define EthicalCompetition::Connection::Connect(), which makes me think that's what you meant to type for the function that prints "Connecting...".
[/quote]

I appreciate this greatly thank you!
0

Share this post


Link to post
Share on other sites
[quote name='JonBMN' timestamp='1345236627' post='4970669']
[quote name='DoctorGlow' timestamp='1345235429' post='4970662']
[quote name='JonBMN' timestamp='1345233041' post='4970651']
And yes it is the board's fault, I suggest before being condescending you just help out and not assume. Thank you.
[/quote]

Then why code snippet from ReaperSMS has spaces and it looks readable?
[/quote]
It's how he put it into the code snippet program; mine came straight from the IDE and I put the [ code ] around it myself. Please do not come onto the forum to argue, this is a place for help. He gave his opinion I gave mine. Neither of us needs you to intervene on this matter, and since your neither helping nor posting for a good reason. I'd ask you to please not post on my topic trying to mediate.

Thank you.
[/quote]

I was curious as to reason of difference between those snippets of the code. There is no reason to get angry about it.
0

Share this post


Link to post
Share on other sites
One used spaces, one used tabs:

[source lang="cpp"] This is a tabbed line.
And another.

This line has two spaces.
And this line.[/source]


The spaces appear to get removed from the code when it's pasted, the tabs don't.
0

Share this post


Link to post
Share on other sites
Disabling the fancy editor makes everything behave more reasonably, I have found (the little light switch in the top left). If anyone else has any editing hints, maybe let people know via private message however, to help keep us on topic.

That said, please don't be so defensive JonBMN, learning how best to prepare your code for the forums is important, it benefits everyone here. We find it easier to read code, and you get more and better responses that are also easy for you to read.
2

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  
Followers 0