Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
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 Respostas
+ 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.