I'm having trouble getting the set-up and namespace to work the way I'm used to with something like Notepad++ of gVIM.
I started an "empty" c++ windows console application project in Visual Studio 2013, and have set up the following test program"
#include <iostream>
using namespace std;
int main() {
hello();
return 0;
}
void hello() { cout << "hello"; }
When I try anything of this form, I get the following error for every call of function declared outside of main()
:
error C3861:'AuxFunction': identifier not found
I don't get any other syntactical or compilation errors.
Is there something I have to change in the project properties (they're all at default except for the empty project and omission of any precompiled headers), or will I have to structure my programs differently if I use Visual Studio?
It's been over a decade since I used VS, but at a glance try adding a prototype for your hello function:
#include <iostream>
using namespace std;
void hello();
int main() {
hello();
return 0;
}
void hello() { cout << "hello"; }
(more general programming than VS, but the error is VS-specific I guess).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.