¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
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 Respuestas
+ 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.