0

In main.cpp

LLC* llc = new LLC();

Here is the constructor in llc.cpp

LLC::LLC() :
{
    cout<<"test"<<endl;
}

Here is the error that I get:

llc.cpp(36): error: expected an identifier
{
^

What mistake am I making? The constructor is given in the public section of the class LLC in the header file of llc.cpp

zeFrenchy
  • 6,493
  • 1
  • 26
  • 36
pistal
  • 2,200
  • 8
  • 40
  • 62

2 Answers2

3
LLC::LLC() :
{
    cout<<"test"<<endl;
}

should be

LLC::LLC()
{
    cout<<"test"<<endl;
}
jsantander
  • 4,816
  • 13
  • 26
0

You are specifying the Member Initializing List in your constructor by adding a :. That's why the compiler is expecting an identifier there. You should remove the : if you do not intend to initialize any members there.

LLC::LLC() // Absense of :
{
    cout<<"test"<<endl;
}
Community
  • 1
  • 1
Abhineet
  • 5,130
  • 1
  • 24
  • 41