The problem is very easy to spot when you walk though it step by step. If you have difficulty doing this "by eye", I recommend learning to use a debugger and step over each line of code so you can see how it's executing.
That said... take a look at what is happening:
1) main does nothing other than creating the locObject object... then calling count().
2) count gets a filename from the user
3) count then clears your 'clas' string, so it is now empty
4) count calls methodcount()
5) methodcount() checks your 'clas' string to see if it is empty. It is (because you just cleared it --- see step 3).. so methodcount immediately exits.
6) Once methodcount exits... count exits... then main and your program exits.
So basically the problem is that methodcount is expecting your 'clas' string to not be empty... but it will always be empty because you never put any data in it.
Try going through it step by step:
1) You create a 'loc' (LOC is the empty vector, clas is the empty string, method is undefined)
2) You ask the user to enter a filename
3) You clear clas (effectively does nothing, since it is already empty)
4) You call methodcount(filename)
5) In methodcount(), you check if clas is empty (it is), and so you return 0
6) Back in count(), you don't return anything (though you have declared it to return an int! This is bad!)
7) Back in main(), you place this anti-returned-value of nothing into val (luckily you don't try to use it)
8) You program exits with return code 0