When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
53 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
It may just be easier to provide your own code, even if it is nearly identical. People answered their issue so shouldn't it answer yours?
If all you did is change the file type/extension, that makes absolutely no difference. All the compiler does is read the code and compile it, it doesn't care what extension you give the file.
What they suggested didn't work
Stack.tpp
@solid jackal Last month I first encountered this but I gave up and just made the declarations all inside the template header file which worked but I assume isn't great practice so I am trying to get to the bottom of it
I believe that Reddit post did answer it - Your .tpp file shouldn't include the header which is including it. That means, remove #include "Stack.h"
I'll troubleshoot a bit more because I still got errors. However, I'm not sure why my book is following this format
@solid jackal doing this works just fine
Though if I split them it's where I just get random laundry list of errors
I realised it seems like you're doing it wrong, the way a templated class with a template header works is:
example.hpp
template<typename Type>
class Example {
public:
void DoSomething();
};
#include "example.tpp"
example.tpp
template<typename Type>
void Example<Type>::DoSomething() {
DidAThing();
}
If you're not required to use a template implementation file, it may be a lot easier to start off implementing it all within the header
But hopefully that example will help
@solid jackal this is how my book did it?
Yeah, that is what I've been doing. Just want to figure this one out though it's not being graded by teacher though he is a very easy grader
Could you post the specific error message?
It's working now
Not sure why
Though I first tried it without the #include "Stack.h" and with and both worked
Are you using visual studio?
It has a crazy annoying bug where it sometimes doesn't compile all of the files you modified
Don't blame yourself for that one
I've assigned a shortcut to build all, and as soon as i see weird behaviour, I just build the whole project everytime I run it from then onwards
Usually it only happens to moderately sized projects
Doesn't hitting start without debugger build all or no?
I see
You can check the console to see which ones were
Does a restart not do anything
Not for me, it might have something to do with the cache
If you show hidden files and delete the .vs folder, it might work
But I've found i prefer to just build all everytime
Do you VS Code or VS?
VS
It might be best to google if anybody have a solution by now, im just so used to building all now
But there might be a patch or whatever
Visual studio not compiling all source files?
Sometimes its hard to tell when its just not compiling a header and not compiling a source
But either way I still find it stupid design
Apparently its intended behaviour if you modify a header file then it doesn't compile it
🤷♂️ I hate it but its the best of the worst to me
I also see the sun rising so I better go, I hope that gets you sorted
Thanks for the help @solid jackal
@wooden pollen
Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.
!solved
Thank you and let us know if you have any more questions!
This thread is now set to auto-hide after an hour of inactivity
@solid jackal Damn it is happening again on another project.
!solved