Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
b3b340657yIn motto.cpp it should be int Motto::run( ){}
You need to specify that your implementation of the run method is from your Motto class. If not run is just a method flying around (not member of the Motto class class). At least I guess -
b3b340657yUnresolved external symbol usually means that you call a declared function that is not defined. In this case its not defined because you are not specifying what class your run method in Motto.cpp should be in
-
b3b340657yOh and also could you please use
#ifndef MYCLASSNAME_H
#define MYCLASSNAME_H
at the top of your header file and
#endif
at the bottom as include guards instead of
#pragma once
?
Just so I can sleep well tonight -
donuts236727y
-
b3b340657y@billgates include guards prevent redefinition of global vars/funcs etc. So the stuff inside your header only gets defined once and after that not anymore. At least I understood it like that xD you could try including your header multiple times and just see what happens with or without include guards
-
alcamore1487y@b3b3 I thought '#pragma once' was essentially shorthand for that though, since it only allows the file to be included once. What's the difference?
-
donuts236727yjust needed an example that works..
It's like Python scripts vs classes it seems and **also the cpp needs to link to the header**
http://p2p.wrox.com/c-programming/... -
alcamore1487y@b3b3 looked into it a bit, found a short article about it if you're interested.
https://msdn.microsoft.com/en-us/... -
theNox92717y@alcamore as far as I know #pragma once is not always supported by compilers and the whole #define thing is just cleaner, because you declare the beginning and the end and everything, you could compare it to not writing brackets and writing brackets
Help... what is wrong with this?
I trying to make a Runner.cpp so can run different programs in the same project.
Why is this static thing not working?
undefined
c++....