Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5838289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:27:07+00:00 2026-05-22T11:27:07+00:00

The well known method for this is to declare int globalVar = 0 and

  • 0

The well known method for this is to declare int globalVar = 0 and then -where to use it- extern int globalVar; but that didn’t work with me for objects from user defined class!

This is an example of what I did:

file1.cpp:

 #include "file2.h"  
class list { ....};  
 list * x ;       
//do something with x` 

file2.cpp:

class list;  
 extern list * x;  
//do something with x

and this is the error I get:

error C2027: use of undefined type 'list'

if I remove class list

error C2143: syntax error : missing ';' before '*' // in `extern list *x;`  
error C4430: missing type specifier - int assumed. Note: C++ does not support 
             default-int

thanks for answers , now it’s like this :

#ifndef _ERRLIST_H_
#define _ERRLIST_H_
#include <queue>
#include <string>

struct errorStruct{
            int errLineNum;
            int errColNum ;
            char * errMessage;
    };
queue <errorStruct> errQueue; //error points here
class ErrList
{

public:
void pushError(int line,int col,char * message);
void popError();    
void printErrors();
int getSize();

};
#endif

but I get this error :

error C2143: syntax error : missing ';' before '<'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:27:08+00:00Added an answer on May 22, 2026 at 11:27 am

    error C2143: syntax error : missing ‘;’ before ‘<‘

    It’s “std::queue<errorStruct>”, not “queue<errorStruct>”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Its a well known fact that a static method can work only on static
This is a well-known bug that cabal can not handle proxies in format http://user:password@host:port
Tomcat has got that well-known memory leak problem that causes PermGen space errors after
It's a well known fact, that Oracle treats empty strings as null. However, I'm
It is well-known that monoids are stunningly ubiquitous in programing. They are so ubiquitous
I'm trying to implement the well-known method used to upload files to a server
It is well known that synchronization is recommended on a final private object (vs.
This may well be a stupid question, but here it goes anyway. In objective
What's the best practice or well known methods to implement sequence numbers for business
It's well-known, the script on http://ryanfait.com/sticky-footer/ : the sticky footer script! A sticky footer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.