| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Build Probs Visual C++ 6
Hi,
Every time i try and build the following program: #include <iostream> using namespace std; int main() { int n, i=1; cout << "Enter a positive integer: "; cin >> n; long sum=0; while (i<=n) sum += i++; cout << "The sum of the first " << n << " integers is " << sum; } the following error appears: --------------------Configuration: 3_14 - Win32 Debug-------------------- Linking... LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 Debug/3_14.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. 3_14.exe - 2 error(s), 0 warning(s) can anyone explain to me what is going wrong and how do I fix it?? Cheers Baz |
|
#2
|
|||
|
|||
|
It is a linker problem try makeing a new project paste that on and put in the correct linkers that you need.
BTW how much was your Visual C++ and where did you get yours?Just asking |
|
#3
|
|||
|
|||
|
You forgot the return 0 at the end, you need to return a interger value when using type int.
#include <iostream> using namespace std; int main() { int n, i=1; cout << "Enter a positive integer: "; cin >> n; long sum=0; while (i<=n) sum += i++; cout << "The sum of the first " << n << " integers is " << sum; return 0; } |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Build Probs Visual C++ 6 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|