Dennis (ever keen to get to grips with the question) asks 'Can we have a quote where he compared philosophy to wanking?' 'Philosophy and the study of the actual world have the same relation to one another as onanism and sexual love' in the German Ideology, here, under the first sub-heading 'Criticism of Religion', second paragraph http://www.marxists.org/archive/marx/works/1845/german-ideology/ch03e.htm
^^^^ CB; Well, yeah that was perhaps youthful exuberance in the first blushes of break with idealist philosophy. But in 1873 he reclaimed revolutionary dialectic, that is , philosophy:
My dialectic method is not only different from the Hegelian, but is its direct opposite. To Hegel, the life process of the human brain, i.e., the process of thinking, which, under the name of “the Idea,” he even transforms into an independent subject, is the demiurgos of the real world, and the real world is only the external, phenomenal form of “the Idea.” With me, on the contrary, the ideal is nothing else than the material world reflected by the human mind, and translated into forms of thought.
The mystifying side of Hegelian dialectic I criticised nearly thirty years ago ( i.e. about 1845 -CB) , at a time when it was still the fashion. But just as I was working at the first volume of “Das Kapital,” it was the good pleasure of the peevish, arrogant, mediocre Epigonoi [Epigones – Büchner, Dühring and others] who now talk large in cultured Germany, to treat Hegel in same way as the brave Moses Mendelssohn in Lessing’s time treated Spinoza, i.e., as a “dead dog.” I therefore openly avowed myself the pupil of that mighty thinker, and even here and there, in the chapter on the theory of value, coquetted with the modes of expression peculiar to him. The mystification which dialectic suffers in Hegel’s hands, by no means prevents him from being the first to present its general form of working in a comprehensive and conscious manner. With him it is standing on its head. It must be turned right side up again, if you would discover the rational kernel within the mystical shell.
In its mystified form, dialectic became the fashion in Germany, because it seemed to transfigure and to glorify the existing state of things. In its rational form it is a scandal and abomination to bourgeoisdom and its doctrinaire professors, because it includes in its comprehension and affirmative recognition of the existing state of things, at the same time also, the recognition of the negation of that state, of its inevitable breaking up; because it regards every historically developed social form as in fluid movement, and therefore takes into account its transient nature not less than its momentary existence; because it lets nothing impose upon it, and is in its essence critical and revolutionary.
And we know from the Theses on Feuerbach that Marx conceived of philosophy as activist, not wanking. _Philosophers_ (emphasis added -CB) have interpreted the world; the thing is to change it.