Minh đang code sơ sơ thì gặp lỗi, nhưng lỗi nó vô lí làm sao đấy, dù em đã tìm trên stackoverflow và lão gg nhưng vẫn chưa có câu trả lời thỏa đáng, hoặc là tìm ra rồi nhưng do mù Anh nên không hiểu. mong mọi người giúp đỡ.
Code C++:
/*InputName program - written by Vo Tran Nha Linh */
#include <iostream> // Input and Output library
#include <string>
using namespace std;
int main()
{
string name;
cout <<"Hello! I am Linh, what is your first name?" ; // Output to ask name.
getline(cin, name); // Input the name.
cout <<"It's nice to meet you!"<< name << "!"; //Output to have a greeting
cout <<"Do you know your name has " << name.length() << " letter(s)?";
cout <<"It starts with " << name.front() <<" letter.";
cout <<"And it ends with "<< name.back()<<" letter.";
cin.ignore();
return 0;
}
Debug:
C:\Windows\system32\cmd.exe /C C:/TDM-GCC-32/bin/mingw32-make.exe -j2 SHELL=cmd.exe -e -f Makefile
"----------Building project:[ CinString - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/Administrator/Desktop/Deane/Codelite/CPPProjects/CinString'
C:/TDM-GCC-32/bin/g++.exe -o ./Debug/CinString @"CinString.txt" -L.
./Debug/InputNumber.cpp.o: In function `main':
C:/Users/Administrator/Desktop/Deane/Codelite/CPPProjects/CinString/InputNumber.cpp:7: multiple definition of `main'
./Debug/InputName.cpp.o:C:/Users/Administrator/Desktop/Deane/Codelite/CPPProjects/CinString/InputName.cpp:8: first defined here
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/CinString] Error 1
mingw32-make.exe: *** [All] Error 2
CinString.mk:78: recipe for target 'Debug/CinString' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/Administrator/Desktop/Deane/Codelite/CPPProjects/CinString'
Makefile:4: recipe for target 'All' failed
====2 errors, 0 warnings====

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?