| View previous topic :: View next topic |
| Author |
Message |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Fri Jan 30, 2009 12:21 am Post subject: [error] C++ functions o-o |
|
|
okay, so i have this code
| Code: |
#include "stdafx.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
lolk(11);
system("PAUSE");
}
int lolk(int kk) {
return 1;
}
|
just some random crap.
so then i test it out and it gives me a
| microsoft visual studio wrote: |
Error 1 error C3861: 'lolk': identifier not found
|
;-; halp? _________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Fri Jan 30, 2009 12:22 am Post subject: |
|
|
| it's defined after you try, and call it. |
|
| Back to top |
|
 |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Fri Jan 30, 2009 12:24 am Post subject: |
|
|
| slovach wrote: | | it's defined after you try, and call it. |
...wut o-o _________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Fri Jan 30, 2009 12:29 am Post subject: |
|
|
#include "stdafx.h"
using namespace std;
int lolk(int kk) {
return 1;
}
int _tmain(int argc, _TCHAR* argv[])
{
lolk(11);
system("PAUSE");
return 0;
} |
|
| Back to top |
|
 |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Fri Jan 30, 2009 12:35 am Post subject: |
|
|
oh damn i'm retarded thanks man _________________
|
|
| Back to top |
|
 |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
Posted: Fri Jan 30, 2009 1:19 am Post subject: |
|
|
or just show him how to declare a function instead
| slovach wrote: |
//edited
#include "stdafx.h"
using namespace std;
int lolk(int kk); // << this will declare the function so the compiler will check the whole file for the function not just above the function you want to use it in
int _tmain(int argc, _TCHAR* argv[])
{
lolk(11);
system("PAUSE");
return 0;
}
int lolk(int kk) {
return 1;
}
|
_________________
dont complain about my english...
1*1 = 2? |
|
| Back to top |
|
 |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Fri Jan 30, 2009 9:38 pm Post subject: |
|
|
ohhh thanks! _________________
|
|
| Back to top |
|
 |
|