0
Class makefile
Hi. Instead of including âMyclas.hâ Iâm including âMyclas.cppâ and it works only like that. Otherwise an error shown âundefined reference to âMyclas::Myclas()â And itâs a public constructor. In Myclas.cpp file I have Myclas.h and Myclas::Myclas(); Donât understand.
4 Answers
+ 1
You should NEVER EVER include a cpp file. The undefined occurred because you might have forgotten to add your cpp file in the compilation command line. Can you show your makefile to be sure please ?
+ 1
I do not found errors in your Makefile, can you show Myclas.cpp/.h please ?
+ 1
it works now. i did a mistake in a Myclas word instead heving Myclas i had Myclass. thanks for help
0
Thanks for an aswer.
Makefike
output: Myclas.o Simplerun.o
g++ Myclas.o Simplerun.o -o output
main.o: Simplerun.cpp
g++ -c Simplerun.cpp
myclas.o: Myclas.cpp Myclas.h
g++ -c Myclas.cpp
Iâve ran it on SublimeText compiler
and on mingw compiler.