Author Topic: Link1561 error: entry point must be defined??  (Read 1144 times)

0 Members and 1 Guest are viewing this topic.

Offline Bigbamino2017

  • /dev/null
  • *
  • Posts: 5
  • Cookies: 1
    • View Profile
Link1561 error: entry point must be defined??
« on: 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
}

just call me BOB

Offline HTH

  • Official EZ Slut
  • Administrator
  • Knight
  • *
  • Posts: 395
  • Cookies: 158
  • EZ Titan
    • View Profile
Re: Link1561 error: entry point must be defined??
« Reply #1 on: 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
« Last Edit: October 28, 2014, 04:01:45 am by HTH »
<ande> HTH is love, HTH is life
<TurboBorland> hth is the only person on this server I can say would successfully spitefuck peoples women

Offline Matriplex

  • Knight
  • **
  • Posts: 323
  • Cookies: 66
  • Java
    • View Profile
Re: Link1561 error: entry point must be defined??
« Reply #2 on: 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.
\x64\x6F\x75\x65\x76\x65\x6E\x00

Offline HTH

  • Official EZ Slut
  • Administrator
  • Knight
  • *
  • Posts: 395
  • Cookies: 158
  • EZ Titan
    • View Profile
Re: Link1561 error: entry point must be defined??
« Reply #3 on: 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
<ande> HTH is love, HTH is life
<TurboBorland> hth is the only person on this server I can say would successfully spitefuck peoples women

Offline Bigbamino2017

  • /dev/null
  • *
  • Posts: 5
  • Cookies: 1
    • View Profile
Re: Link1561 error: entry point must be defined??
« Reply #4 on: 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
just call me BOB

Offline Nortcele

  • Knight
  • **
  • Posts: 211
  • Cookies: -42
  • █+█=██
    • View Profile
Re: Link1561 error: entry point must be defined??
« Reply #5 on: 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!! :)
~JaySec
~LulzBlog

TAKE A COOKIE!




0100000101010011010000110100100101001001

Offline Xires

  • Noob Eater
  • Administrator
  • Knight
  • *
  • Posts: 379
  • Cookies: 149
    • View Profile
    • Feed The Trolls - Xires
Re: Link1561 error: entry point must be defined??
« Reply #6 on: 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...

Code: (c++) [Select]
#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;
}
-Xires