Void Function

Hello there,
I have been working on a little piece of code that is part of some work for my C++ course in university. Now I am not going to lie, I suck at C++ regardless of how hard I try to learn it.

The following code had some errors in which I had to locate and fix:

#include <iostream>
using std::cout; using std::endl;
void create(void);
class Count
{
public:
Count(int=1, int=1);
void print() const {cout << day << " " << num << endl;}
private:
int day;
int num;
};
Count::Count(int d, int c)
{
day = d;
num = c;
}
int main()
{
Count firstObj;
Count secondObj(2,3);
secondObj.print();
return 0;
}

The only thing I don't understand is why void create(void); is necessary for the program to run. Any clarification would be appreciated.
What do you mean it is necessary to run? Are you getting a compile error when removing it? I don't see any function call or implementation for create() anywhere in your program.
If I comment out "void create(void);" I get a build error "error C3861: 'create': identifier not found".
closed account (S6k9GNh0)
Do you have it implemented somewhere? What does it do, where is it called, etc.
Are you compiling this under Windows / VS? What kind of project? Console? Win32?
computerquip

I don't what it does or why it is necessary that is why I am posting here :P

I am using Visual Studios 2008 and it is a Win32 Console Application.
I think has to do with the MS compiler and the type of project you are compiling as, but I am not a windows programmer. You might get more help by moving this subject to the Windows programming forum.

I commented out that line and compiled the project in Visual Studio 2008 with no trouble. The function prototype has no purpose in the code you provided. Are you sure that there is nothing else in the project? You might want to try creating a new project to see if you still get the error.
Check your project folder and make sure you don't have any other .cpp files in there that you don't need.
Topic archived. No new replies allowed.