1

I have the following code:

        #include <queue>
        struct Job                  
        {
        };
        queue<Job> _jobQueue;

But I get the error:

error: ISO C++ forbids declaration of âqueueâ with no type

How can I make a queue for my struct?

3
  • Sounds like you're missing an include? Commented Nov 28, 2011 at 1:03
  • 5
    (Note that names beginning with a leading underscore followed by a capital letter are reserved for the implementation -- the leading underscore is generally avoided for this reason. Commented Nov 28, 2011 at 1:06
  • 1
    Also, all names with global scope that start with an underscore are reserved - such as _jobQueue in this fragment. Commented Nov 28, 2011 at 8:12

2 Answers 2

6

You didn't #include <queue>.

EDIT: After your edit, you need to qualify that as std::queue<Job>.

Sign up to request clarification or add additional context in comments.

2 Comments

forgot to put that in the example, but not the issue here :(
@Garrett: Yes, it is. Check your includes; check that you're qualifying in the std namespace as required.
5

Try the following

std::queue<Job> _jobQueue;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.