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,541
  • 1
  • 27
  • 36
pistal
  • 2,310
  • 13
  • 41
  • 65

2 Answers2

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

should be

LLC::LLC()
{
    cout<<"test"<<endl;
}
jsantander
  • 4,972
  • 16
  • 27
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,320
  • 1
  • 25
  • 43