Public Group

Random error occurences? [ NOT Solved]

This topic is 4877 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I'd really love to wait until my earlier thread is off the top of the list, as spam is something everyone is willing to give, but no one wants, but regrettably, time is not a resource I currently have masses of, so I'll have to post this now. I'm having a big problem. I have a project (not even near completion) which compiles fine. Now, in that project, I have a class called 'Task', in the 'ASC-Task.hpp' file, as seen here: ASC-Task.hpp
#ifndef ASC_TASK_HPP

#include "ASC-Define.hpp"
#include "ASC-Callbacks.hpp"

namespace ASC
{
namespace Core
{
{
public:

virtual ASCCB * Update() = 0;
virtual ASCCB * OnKill() = 0;

protected:
void SetVals(ASCSINT id, ASCSTRING name, ASCSTRING desc);

private:
};
}
}

#endif


#ifndef ASC_ENTRYTASK_HPP

#include "ASC-Define.hpp"

namespace ASC
{
namespace Core
{
{
public:

virtual ASCCB * Update() = 0;
virtual ASCCB * OnKill() = 0;
protected:
private:
};
}
}

#endif


I really can't make anything of this, so if anyone here would be kind enough to perhaps tell me why everything is so screwed with the addition of that file, I'd be quite thankful [smile] Cheers! [EDIT] In case anyone notices the line: class EntryTask : public Task Should I include the full name there, that is, ASC::Core::Task there? Because it seems that at least for friend declarations, I can't do that, or it gives me an error. [Edited by - SirLuthor on February 9, 2005 5:10:45 AM]

Share on other sites
Have you done:
#include <string>using namespace std;

? It seems like that is why the cout is not a member of std.

- Drew

Share on other sites
I use no 'using' directives at all.

In case it helps, I'm getting errors before every opening and closing brace, like:
error C2143: syntax error : missing ; before {
or
error C2143: syntax error : missing ; before }

Share on other sites
Sorry, I meant that you need this:
#include <iostream>using namespace std;

Brain lapse where cout was located at [lol].

Hmm, check all of the .hpp files and make sure the classes have a ; at the closing brace.

Here is a quick reference to namespaces. I'm thinking there may be a collision with the namespace usage somehow when you add that file in. What does the define.hpp look like as well as the other one.

Share on other sites
I have of course included <iostream>. Remember, I said that there were ZERO errors before I included that one file.

Share on other sites
if your not putting it in as <iostream.h> you have to do "using namespace std".. just add a .h and it *should* work. At least, it does that on my compiler :).

~zix~

Share on other sites
If you are using Microsoft Visual C++, (may not be the only one with this problem, but the only one I've tested it on is this one.) all standard includes (incorrect usage of term? I meant iostream and all that) HAVE to come above all of your own includes.

I've found that if you don't put standard includes first, then you will get the errors you've listed.

Share on other sites
Quote:
 Original post by zix99if your not putting it in as you have to do "using namespace std".. just add a .h and it *should* work. At least, it does that on my compiler :).~zix~

No if about it, never use <iostream.h>. And you don't have to do "using namespace std", you can just pull out the bits you're actually using or use fully qualified names. Really, they stuck everything in that neat little container to avoid conflicts, dumping everything out into the global namespace kind of defeats the whole point.

Share on other sites
Drew_Benton: Regarding checking classes for missing ; Presumably, if I had a missing semi-colon somewhere, it would have been picked up by the compiler earlier, even before I added the ASC-EntryTask.hpp file in? As for ASC-define.hpp, it's just a load of #define's, like, '#define ASCCB ASC::Core::Callback', etc.

Lenox: I'll have a look and check if all my includes are ordered properly, I tend to put C++ standard includeds on top, in alphabetical order, followed by other includes, also in alphabetical order. But I'll check, hell, if that's the reason for all my errors, I'd be quite happy :)

Share on other sites
Oh. my. god. I hate it when I do that... Such a simple mistake, I probably never would have found it, if not by pure chance of having encountered something sort of like this a while back, which I had forgotten about.

Of course, simple beginner's mistake as it was, that was a very vexing experience.. And I still can't figure out why it borked all my curly braces [smile].... Cheers folks, and thanks for the input! Apparently, #include'ing in alphabetical order is not always the optimal setup :D

• 33
• 12
• 10
• 9
• 9
• Forum Statistics

• Total Topics
631353
• Total Posts
2999488
×