Weird Void Error 
  Oct 20, 2017 at 7:50pm UTC  
 
Hello, i am trying to make a simple game inside of windows console in c++, but for some reason i am getting an error that says  unresolved external symbol "void __cdecl Intro(void)" (?Intro@@YAXXZ)   
here is the code inside of my main file where i want to program to begin, i don't understand what i did wrong. Could someone please help me if they know.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 
  #include "stdafx.h" 
#include "Macros.h" 
#include "Character.h" 
#include "Actors.h" 
int  main()
{
	string answer;
	Character Player;
	void  Intro(); {
		OUTPUT "Welcome to Eternal, please enter your name: " ;
		INPUT Player.Name;
		OUTPUT "Is this correct? y|n"  << Player.Name;
		INPUT answer;
		if  (answer == "y" ) {
			system("pause" );
		}
		if  (answer == "n" ) {
			Intro();
		}
	}
    Intro();
}
 
in my macros.h i did  
1 2 3 4 
 #define OUTPUT cout << 
#define INPUT cin >> 
#define PAUSE getchar; 
using  namespace  std;
 
and in my character.h i did
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 
#pragma once 
#include <iostream> 
#include <string> 
using  namespace  std;
class  Character {
public :
	string Name;
	string LVL;
	string EXP;
	string Strength;
	string COL;
	string Aglity;
};
 
 
 
 
 
 
  Oct 20, 2017 at 8:04pm UTC  
 
You can't define a function inside of another function.  
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 
void  Intro() 
{
        string answer;
	Character Player;
	OUTPUT "Welcome to Eternal, please enter your name: " ;
	INPUT Player.Name;
	OUTPUT "Is this correct? y|n"  << Player.Name;
	INPUT answer;
	if  (answer == "y" ) {
		system("pause" );
	}
	if  (answer == "n" ) {
		Intro();
	}
}
int  main()
{
        Intro();
        return  0;
}
 
 
http://www.cplusplus.com/doc/tutorial/functions/ 
As a side note don't get into the habit of redefining cout/cin etc.  It makes your code harder to read.  
 
Last edited on Oct 20, 2017 at 8:06pm UTC  
 
 
 
 
  Oct 20, 2017 at 8:09pm UTC  
 
Thank you so much Hippogriff i guess i forgot about that at some point. and yeah it does make it harder by define them.
 
 
 
Topic archived. No new replies allowed.