EvilZone

Programming and Scripting => C - C++ => : Bigbamino2017 October 28, 2014, 03:31:20 AM

: Link1561 error: entry point must be defined??
: Bigbamino2017 October 28, 2014, 03:31:20 AM


#include <iostream>
//#include is importing the iostream class


using namespace std;
// using namespace is telling the program to use functions from the standared libary of std


int main() // main is where the program will execute where int is a method called
{
   int age;


   cout << "HEY, you, I'm alive! Oh, and Hello World!"; // cout << is the string output
   cout << "How Old are you";
   cin >> age;v// going to take input and attach it to int age
   cin.ignore(); // going to toss the enter key
   cout << "You are " << age << "\n";
   cin.get(); // pauses the screen




   return 1; //we have to do a return because we are using the method int
}


   return 1; //we have to do a return because we are using the method int
}

: Re: Link1561 error: entry point must be defined??
: HTH October 28, 2014, 03:57:40 AM
Im lazy, so i just bolded where you dun goofed.


#include <iostream>
//#include is importing the iostream class


using namespace std;
// using namespace is telling the program to use functions from the standared libary of std


int main() // main is where the program will execute where int is a method called
{
   int age;


   cout << "HEY, you, I'm alive! Oh, and Hello World!"; // cout << is the string output
   cout << "How Old are you";
   cin >> age;v// going to take input and attach it to int age
   cin.ignore(); // going to toss the enter key
   cout << "You are " << age << "\n";
   cin.get(); // pauses the screen




   return 1; //we have to do a return because we are using the method int
}


   return 1; //we have to do a return because we are using the method int
}



Oh and, JS, usually return 0 means no errors, return anything else means an error occurred
: Re: Link1561 error: entry point must be defined??
: Matriplex October 28, 2014, 04:16:19 AM
Bob, you done fucked up.

Spending a few seconds to debug doesn't hurt anyone. While I'm posting here, I may as well be a little helpful about it; I've heard that you shouldn't  always use "using namespace std;" but rather use the exact thing you're going to need, e.g. "using std::cin;". Just a tip, not that it really matters in a little program like that. Correct me if I'm wrong, I'm more familiar with Java conventions.
: Re: Link1561 error: entry point must be defined??
: HTH October 28, 2014, 05:53:11 AM
Bob, you done fucked up.

Spending a few seconds to debug doesn't hurt anyone. While I'm posting here, I may as well be a little helpful about it; I've heard that you shouldn't  always use "using namespace std;" but rather use the exact thing you're going to need, e.g. "using std::cin;". Just a tip, not that it really matters in a little program like that. Correct me if I'm wrong, I'm more familiar with Java conventions.

No you are correct, in this program it would have been better to say using std::cin; using std::cout;

but he also should have a little thing called a new line in a few spots.

I just am not gonna explain namespaces and why the smallest scope that can get the job done is usually best to someone who can't debug a "i fucked up and put a v beside a semi colon" or "I copy pasted the ending of my program twice" :p
u
: Re: Link1561 error: entry point must be defined??
: Bigbamino2017 October 30, 2014, 03:04:23 AM
lol I just checked this post after fixing it but I will be taking your suggestions into heart and yeah I didn't notice the V for some reason till I read the code 8 times
: Re: Link1561 error: entry point must be defined??
: Nortcele October 30, 2014, 12:06:09 PM
lol I just checked this post after fixing it but I will be taking your suggestions into heart and yeah I didn't notice the V for some reason till I read the code 8 times

use a Debugger next time!! :)
: Re: Link1561 error: entry point must be defined??
: Xires November 02, 2014, 09:47:48 AM
Those who commented about the namespace usage are correct; it's not necessary(nor advisable) to include an entire namespace unless you need more than just a few functions.  You can precede the function with the namespace e.g. "std::cout" or, alternatively...

: (c++)
#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main(void) {
int age;

cout << "HEY, you, I'm alive! Oh, and Hello World!" << endl;
cout << "How Old are you";

cin >> age;
cin.ignore();

cout << "You are " << age << endl;

cin.get();

return 0;
}