This is my third C++ application, so I am a beginner. Please have a look at the following code
Main.cpp
#include<iostream>
#include <string>
#include "GradeBook.h"
using namespace std;
int main()
{
GradeBook myGradeBook1("Java");
GradeBook myGradeBook2("C++");
cout << "Course Name is: " << myGradeBook1.getCourseName() << endl;
cout << "Course Name2 is: " << myGradeBook2.getCourseName() << endl;
}
GradeBook.h
#include <iostream>
#include <string>
using namespace std;
class GradeBook
{
private:
string courseName;
public:
GradeBook(string name)
{
setCourseName(name);
}
void setCourseName(string name)
{
courseName = name;
}
string getCourseName()
{
return courseName;
}
void displayMessage()
{
cout << "Welcome to " << getCourseName() << endl;
}
};
Now, when I run the program (I use netbeans, compiler is cygwin), it gives the following error:
> "/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= > .build-conf make[1]: Entering directory > `/cygdrive/c/Users/Yohan/Documents/NetBeansProjects/LearnCPlusPlus' > "/usr/bin/make" -f nbproject/Makefile-Debug.mk > dist/Debug/Cygwin-Windows/learncplusplus.exe make[2]: Entering > directory > `/cygdrive/c/Users/Yohan/Documents/NetBeansProjects/LearnCPlusPlus' > mkdir -p build/Debug/Cygwin-Windows rm -f > build/Debug/Cygwin-Windows/ClassWithPara.o.d g++ -c -g -MMD -MP -MF > build/Debug/Cygwin-Windows/ClassWithPara.o.d -o > build/Debug/Cygwin-Windows/ClassWithPara.o ClassWithPara.cpp > ClassWithPara.cpp:28:4: warning: no newline at end of file mkdir -p > dist/Debug/Cygwin-Windows g++ -o > dist/Debug/Cygwin-Windows/learncplusplus > build/Debug/Cygwin-Windows/IfStatement.o > build/Debug/Cygwin-Windows/ClassWithConstructors.o > build/Debug/Cygwin-Windows/HelloWorld.o > build/Debug/Cygwin-Windows/ClassWithSetters.o > build/Debug/Cygwin-Windows/ClassWithPara.o > build/Debug/Cygwin-Windows/FirstClass.o > build/Debug/Cygwin-Windows/AddIntegers.o > nbproject/Makefile-Debug.mk:68: recipe for target > `dist/Debug/Cygwin-Windows/learncplusplus.exe' failed make[2]: Leaving > directory > `/cygdrive/c/Users/Yohan/Documents/NetBeansProjects/LearnCPlusPlus' > nbproject/Makefile-Debug.mk:65: recipe for target `.build-conf' failed > make[1]: Leaving directory > `/cygdrive/c/Users/Yohan/Documents/NetBeansProjects/LearnCPlusPlus' > nbproject/Makefile-impl.mk:39: recipe for target `.build-impl' failed > /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(libcmain.o): In > function `main': > /usr/src/debug/cygwin-1.7.16-1/winsup/cygwin/lib/libcmain.c:39: > undefined reference to `_WinMain@16' collect2: ld returned 1 exit > status make[2]: *** [dist/Debug/Cygwin-Windows/learncplusplus.exe] > Error 1 make[1]: *** [.build-conf] Error 2 make: *** [.build-impl] > Error 2 > > > BUILD FAILED (exit value 2, total time: 11s)