Got a problem... I'm trying to do a little test of the .length() function in C++. The compile and code both look good... I think. But whenever I try to run the program I get this error.
--------------------Configuration: A2 Part 1 - Win32 Debug--------------------
Compiling...
splitter.cpp
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/A2 Part 1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
A2 Part 1.exe - 2 error(s), 0 warning(s)
My program current reads like this;
#include <iostream> // for cin, cout
#include <iomanip> // for setw(), setprecision()
#include <string>
using namespace std;
int main()
{
string phrase;
// string::size_type len;
cout << "Enter 5 words ending each word with a //, including the last on. Press enter when you have finshed.";
cin >> phrase;
cout <<endl <<endl;
cout <<phrase.length() <<endl;
return 0;
}
All I want is to see the number of characters there are in the phrase I want to enter.
Question
deck
Got a problem... I'm trying to do a little test of the .length() function in C++. The compile and code both look good... I think. But whenever I try to run the program I get this error.
--------------------Configuration: A2 Part 1 - Win32 Debug--------------------
Compiling...
splitter.cpp
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/A2 Part 1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
A2 Part 1.exe - 2 error(s), 0 warning(s)
My program current reads like this;
#include <iostream> // for cin, cout
#include <iomanip> // for setw(), setprecision()
#include <string>
using namespace std;
int main()
{
string phrase;
// string::size_type len;
cout << "Enter 5 words ending each word with a //, including the last on. Press enter when you have finshed.";
cin >> phrase;
cout <<endl <<endl;
cout <<phrase.length() <<endl;
return 0;
}
All I want is to see the number of characters there are in the phrase I want to enter.
Any help would be appreciated.
Thanks!
Link to comment
Share on other sites
2 answers to this question
Recommended Posts