c++ Include in linux, and gcc raises error which occurs within ? [closed]





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







-2















I try to use bitset in my c++ code, the desired behavior is my code man pass compiling and use bitset correctly.



The specific problem is while compiling gcc raise this:



g++ -g -Wall -Wshadow -I../bin -I../filesys -I../userprog -I../threads -I../machine -DUSER_PROGRAM -DFILESYS_NEEDED -DFILESYS_STUB  -DHOST_i386 -DCHANGED  -c ../threads/synch.cc
In file included from ../machine/machine.h:28:0,
from ../threads/thread.h:47,
from ../threads/synch.h:21,
from ../threads/synch.cc:26:
/usr/include/c++/4.6/bitset: In member function 'void std::bitset<_Nb>::_M_copy_from_ptr(const _CharT*, std::size_t, std::size_t, std::size_t, _CharT, _CharT)':
/usr/include/c++/4.6/bitset:1371:30: error: expected unqualified-id before '(' token
/usr/include/c++/4.6/bitset:1371:30: error: expected unqualified-id before '(' token
/usr/include/c++/4.6/bitset:1371:30: error: expected unqualified-id before '(' token


what does " expected unqualified-id before '(' token" mean, and how do I fix this?



1371 line of file bitset is :



// Definitions of non-inline member functions.
template<size_t _Nb>
template<class _CharT, class _Traits>
void
bitset<_Nb>::
_M_copy_from_ptr(const _CharT* __s, size_t __len,
size_t __pos, size_t __n, _CharT __zero, _CharT __one)
{
reset();
const size_t __nbits = std::min(_Nb, std::min(__n, __len - __pos));
for (size_t __i = __nbits; __i > 0; --__i)
{
const _CharT __c = __s[__pos + __nbits - __i];
if (_Traits::eq(__c, __zero))
;
else if (_Traits::eq(__c, __one))
_Unchecked_set(__i - 1);
else
__throw_invalid_argument(__N("bitset::_M_copy_from_ptr"));
}
}









share|improve this question















closed as off-topic by Some programmer dude, πάντα ῥεῖ, Killzone Kid, gsamaras, Toby Speight Nov 22 '18 at 9:23


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Some programmer dude, πάντα ῥεῖ, Killzone Kid, gsamaras, Toby Speight

If this question can be reworded to fit the rules in the help center, please edit the question.

















  • Please don't post image of text, copy-paste it as text, in full and complete, into the question instead. And we don't need to see the system header, because the cause of the error isn't there, it's in your code. So also please shown us an Minimal, Complete, and Verifiable example of your code causing the error. Also please read about how to ask good questions, as well as this question checklist.

    – Some programmer dude
    Nov 22 '18 at 6:42











  • The message is 1371, not 1731

    – M.M
    Nov 22 '18 at 6:46











  • Thank you. I will paste words.

    – pkutp
    Nov 22 '18 at 8:38











  • But gcc compiler says the error is in the system header. This is where I don't understand and want to ask.

    – pkutp
    Nov 22 '18 at 8:40











  • Thank you, it is 1371, "1731" is just a typo and the code i paste is actually 1371.

    – pkutp
    Nov 22 '18 at 8:42


















-2















I try to use bitset in my c++ code, the desired behavior is my code man pass compiling and use bitset correctly.



The specific problem is while compiling gcc raise this:



g++ -g -Wall -Wshadow -I../bin -I../filesys -I../userprog -I../threads -I../machine -DUSER_PROGRAM -DFILESYS_NEEDED -DFILESYS_STUB  -DHOST_i386 -DCHANGED  -c ../threads/synch.cc
In file included from ../machine/machine.h:28:0,
from ../threads/thread.h:47,
from ../threads/synch.h:21,
from ../threads/synch.cc:26:
/usr/include/c++/4.6/bitset: In member function 'void std::bitset<_Nb>::_M_copy_from_ptr(const _CharT*, std::size_t, std::size_t, std::size_t, _CharT, _CharT)':
/usr/include/c++/4.6/bitset:1371:30: error: expected unqualified-id before '(' token
/usr/include/c++/4.6/bitset:1371:30: error: expected unqualified-id before '(' token
/usr/include/c++/4.6/bitset:1371:30: error: expected unqualified-id before '(' token


what does " expected unqualified-id before '(' token" mean, and how do I fix this?



1371 line of file bitset is :



// Definitions of non-inline member functions.
template<size_t _Nb>
template<class _CharT, class _Traits>
void
bitset<_Nb>::
_M_copy_from_ptr(const _CharT* __s, size_t __len,
size_t __pos, size_t __n, _CharT __zero, _CharT __one)
{
reset();
const size_t __nbits = std::min(_Nb, std::min(__n, __len - __pos));
for (size_t __i = __nbits; __i > 0; --__i)
{
const _CharT __c = __s[__pos + __nbits - __i];
if (_Traits::eq(__c, __zero))
;
else if (_Traits::eq(__c, __one))
_Unchecked_set(__i - 1);
else
__throw_invalid_argument(__N("bitset::_M_copy_from_ptr"));
}
}









share|improve this question















closed as off-topic by Some programmer dude, πάντα ῥεῖ, Killzone Kid, gsamaras, Toby Speight Nov 22 '18 at 9:23


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Some programmer dude, πάντα ῥεῖ, Killzone Kid, gsamaras, Toby Speight

If this question can be reworded to fit the rules in the help center, please edit the question.

















  • Please don't post image of text, copy-paste it as text, in full and complete, into the question instead. And we don't need to see the system header, because the cause of the error isn't there, it's in your code. So also please shown us an Minimal, Complete, and Verifiable example of your code causing the error. Also please read about how to ask good questions, as well as this question checklist.

    – Some programmer dude
    Nov 22 '18 at 6:42











  • The message is 1371, not 1731

    – M.M
    Nov 22 '18 at 6:46











  • Thank you. I will paste words.

    – pkutp
    Nov 22 '18 at 8:38











  • But gcc compiler says the error is in the system header. This is where I don't understand and want to ask.

    – pkutp
    Nov 22 '18 at 8:40











  • Thank you, it is 1371, "1731" is just a typo and the code i paste is actually 1371.

    – pkutp
    Nov 22 '18 at 8:42














-2












-2








-2








I try to use bitset in my c++ code, the desired behavior is my code man pass compiling and use bitset correctly.



The specific problem is while compiling gcc raise this:



g++ -g -Wall -Wshadow -I../bin -I../filesys -I../userprog -I../threads -I../machine -DUSER_PROGRAM -DFILESYS_NEEDED -DFILESYS_STUB  -DHOST_i386 -DCHANGED  -c ../threads/synch.cc
In file included from ../machine/machine.h:28:0,
from ../threads/thread.h:47,
from ../threads/synch.h:21,
from ../threads/synch.cc:26:
/usr/include/c++/4.6/bitset: In member function 'void std::bitset<_Nb>::_M_copy_from_ptr(const _CharT*, std::size_t, std::size_t, std::size_t, _CharT, _CharT)':
/usr/include/c++/4.6/bitset:1371:30: error: expected unqualified-id before '(' token
/usr/include/c++/4.6/bitset:1371:30: error: expected unqualified-id before '(' token
/usr/include/c++/4.6/bitset:1371:30: error: expected unqualified-id before '(' token


what does " expected unqualified-id before '(' token" mean, and how do I fix this?



1371 line of file bitset is :



// Definitions of non-inline member functions.
template<size_t _Nb>
template<class _CharT, class _Traits>
void
bitset<_Nb>::
_M_copy_from_ptr(const _CharT* __s, size_t __len,
size_t __pos, size_t __n, _CharT __zero, _CharT __one)
{
reset();
const size_t __nbits = std::min(_Nb, std::min(__n, __len - __pos));
for (size_t __i = __nbits; __i > 0; --__i)
{
const _CharT __c = __s[__pos + __nbits - __i];
if (_Traits::eq(__c, __zero))
;
else if (_Traits::eq(__c, __one))
_Unchecked_set(__i - 1);
else
__throw_invalid_argument(__N("bitset::_M_copy_from_ptr"));
}
}









share|improve this question
















I try to use bitset in my c++ code, the desired behavior is my code man pass compiling and use bitset correctly.



The specific problem is while compiling gcc raise this:



g++ -g -Wall -Wshadow -I../bin -I../filesys -I../userprog -I../threads -I../machine -DUSER_PROGRAM -DFILESYS_NEEDED -DFILESYS_STUB  -DHOST_i386 -DCHANGED  -c ../threads/synch.cc
In file included from ../machine/machine.h:28:0,
from ../threads/thread.h:47,
from ../threads/synch.h:21,
from ../threads/synch.cc:26:
/usr/include/c++/4.6/bitset: In member function 'void std::bitset<_Nb>::_M_copy_from_ptr(const _CharT*, std::size_t, std::size_t, std::size_t, _CharT, _CharT)':
/usr/include/c++/4.6/bitset:1371:30: error: expected unqualified-id before '(' token
/usr/include/c++/4.6/bitset:1371:30: error: expected unqualified-id before '(' token
/usr/include/c++/4.6/bitset:1371:30: error: expected unqualified-id before '(' token


what does " expected unqualified-id before '(' token" mean, and how do I fix this?



1371 line of file bitset is :



// Definitions of non-inline member functions.
template<size_t _Nb>
template<class _CharT, class _Traits>
void
bitset<_Nb>::
_M_copy_from_ptr(const _CharT* __s, size_t __len,
size_t __pos, size_t __n, _CharT __zero, _CharT __one)
{
reset();
const size_t __nbits = std::min(_Nb, std::min(__n, __len - __pos));
for (size_t __i = __nbits; __i > 0; --__i)
{
const _CharT __c = __s[__pos + __nbits - __i];
if (_Traits::eq(__c, __zero))
;
else if (_Traits::eq(__c, __one))
_Unchecked_set(__i - 1);
else
__throw_invalid_argument(__N("bitset::_M_copy_from_ptr"));
}
}






c++ std bitset






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 7:59







pkutp

















asked Nov 22 '18 at 6:39









pkutppkutp

62




62




closed as off-topic by Some programmer dude, πάντα ῥεῖ, Killzone Kid, gsamaras, Toby Speight Nov 22 '18 at 9:23


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Some programmer dude, πάντα ῥεῖ, Killzone Kid, gsamaras, Toby Speight

If this question can be reworded to fit the rules in the help center, please edit the question.







closed as off-topic by Some programmer dude, πάντα ῥεῖ, Killzone Kid, gsamaras, Toby Speight Nov 22 '18 at 9:23


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Some programmer dude, πάντα ῥεῖ, Killzone Kid, gsamaras, Toby Speight

If this question can be reworded to fit the rules in the help center, please edit the question.













  • Please don't post image of text, copy-paste it as text, in full and complete, into the question instead. And we don't need to see the system header, because the cause of the error isn't there, it's in your code. So also please shown us an Minimal, Complete, and Verifiable example of your code causing the error. Also please read about how to ask good questions, as well as this question checklist.

    – Some programmer dude
    Nov 22 '18 at 6:42











  • The message is 1371, not 1731

    – M.M
    Nov 22 '18 at 6:46











  • Thank you. I will paste words.

    – pkutp
    Nov 22 '18 at 8:38











  • But gcc compiler says the error is in the system header. This is where I don't understand and want to ask.

    – pkutp
    Nov 22 '18 at 8:40











  • Thank you, it is 1371, "1731" is just a typo and the code i paste is actually 1371.

    – pkutp
    Nov 22 '18 at 8:42



















  • Please don't post image of text, copy-paste it as text, in full and complete, into the question instead. And we don't need to see the system header, because the cause of the error isn't there, it's in your code. So also please shown us an Minimal, Complete, and Verifiable example of your code causing the error. Also please read about how to ask good questions, as well as this question checklist.

    – Some programmer dude
    Nov 22 '18 at 6:42











  • The message is 1371, not 1731

    – M.M
    Nov 22 '18 at 6:46











  • Thank you. I will paste words.

    – pkutp
    Nov 22 '18 at 8:38











  • But gcc compiler says the error is in the system header. This is where I don't understand and want to ask.

    – pkutp
    Nov 22 '18 at 8:40











  • Thank you, it is 1371, "1731" is just a typo and the code i paste is actually 1371.

    – pkutp
    Nov 22 '18 at 8:42

















Please don't post image of text, copy-paste it as text, in full and complete, into the question instead. And we don't need to see the system header, because the cause of the error isn't there, it's in your code. So also please shown us an Minimal, Complete, and Verifiable example of your code causing the error. Also please read about how to ask good questions, as well as this question checklist.

– Some programmer dude
Nov 22 '18 at 6:42





Please don't post image of text, copy-paste it as text, in full and complete, into the question instead. And we don't need to see the system header, because the cause of the error isn't there, it's in your code. So also please shown us an Minimal, Complete, and Verifiable example of your code causing the error. Also please read about how to ask good questions, as well as this question checklist.

– Some programmer dude
Nov 22 '18 at 6:42













The message is 1371, not 1731

– M.M
Nov 22 '18 at 6:46





The message is 1371, not 1731

– M.M
Nov 22 '18 at 6:46













Thank you. I will paste words.

– pkutp
Nov 22 '18 at 8:38





Thank you. I will paste words.

– pkutp
Nov 22 '18 at 8:38













But gcc compiler says the error is in the system header. This is where I don't understand and want to ask.

– pkutp
Nov 22 '18 at 8:40





But gcc compiler says the error is in the system header. This is where I don't understand and want to ask.

– pkutp
Nov 22 '18 at 8:40













Thank you, it is 1371, "1731" is just a typo and the code i paste is actually 1371.

– pkutp
Nov 22 '18 at 8:42





Thank you, it is 1371, "1731" is just a typo and the code i paste is actually 1371.

– pkutp
Nov 22 '18 at 8:42












1 Answer
1






active

oldest

votes


















2














Hard to say from just this snippet, but pretty much the only reason syntax errors happen in system headers is that your code defines a macro that somehow conflicts with the code.



The most likely candidate here is min. A macro by this name is unfortunately quite wide-spread; e.g. windows.h defines one unless you define NOMINMAX before including it. There are other headers that do the same thing.



One thing you can do to diagnose this is to put this code snippet after every individual include in your source files:



#if defined(min)
#error Previous include defined min
#endif


Then once you know which header is responsible, you can try to find out how to prevent it from doing that (or #undef the macro if necessary).






share|improve this answer
























  • Thank you. I did define min elsewhere. After removing it the problem is solved.

    – pkutp
    Nov 23 '18 at 8:05


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Hard to say from just this snippet, but pretty much the only reason syntax errors happen in system headers is that your code defines a macro that somehow conflicts with the code.



The most likely candidate here is min. A macro by this name is unfortunately quite wide-spread; e.g. windows.h defines one unless you define NOMINMAX before including it. There are other headers that do the same thing.



One thing you can do to diagnose this is to put this code snippet after every individual include in your source files:



#if defined(min)
#error Previous include defined min
#endif


Then once you know which header is responsible, you can try to find out how to prevent it from doing that (or #undef the macro if necessary).






share|improve this answer
























  • Thank you. I did define min elsewhere. After removing it the problem is solved.

    – pkutp
    Nov 23 '18 at 8:05
















2














Hard to say from just this snippet, but pretty much the only reason syntax errors happen in system headers is that your code defines a macro that somehow conflicts with the code.



The most likely candidate here is min. A macro by this name is unfortunately quite wide-spread; e.g. windows.h defines one unless you define NOMINMAX before including it. There are other headers that do the same thing.



One thing you can do to diagnose this is to put this code snippet after every individual include in your source files:



#if defined(min)
#error Previous include defined min
#endif


Then once you know which header is responsible, you can try to find out how to prevent it from doing that (or #undef the macro if necessary).






share|improve this answer
























  • Thank you. I did define min elsewhere. After removing it the problem is solved.

    – pkutp
    Nov 23 '18 at 8:05














2












2








2







Hard to say from just this snippet, but pretty much the only reason syntax errors happen in system headers is that your code defines a macro that somehow conflicts with the code.



The most likely candidate here is min. A macro by this name is unfortunately quite wide-spread; e.g. windows.h defines one unless you define NOMINMAX before including it. There are other headers that do the same thing.



One thing you can do to diagnose this is to put this code snippet after every individual include in your source files:



#if defined(min)
#error Previous include defined min
#endif


Then once you know which header is responsible, you can try to find out how to prevent it from doing that (or #undef the macro if necessary).






share|improve this answer













Hard to say from just this snippet, but pretty much the only reason syntax errors happen in system headers is that your code defines a macro that somehow conflicts with the code.



The most likely candidate here is min. A macro by this name is unfortunately quite wide-spread; e.g. windows.h defines one unless you define NOMINMAX before including it. There are other headers that do the same thing.



One thing you can do to diagnose this is to put this code snippet after every individual include in your source files:



#if defined(min)
#error Previous include defined min
#endif


Then once you know which header is responsible, you can try to find out how to prevent it from doing that (or #undef the macro if necessary).







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 '18 at 9:01









Sebastian RedlSebastian Redl

50.9k476116




50.9k476116













  • Thank you. I did define min elsewhere. After removing it the problem is solved.

    – pkutp
    Nov 23 '18 at 8:05



















  • Thank you. I did define min elsewhere. After removing it the problem is solved.

    – pkutp
    Nov 23 '18 at 8:05

















Thank you. I did define min elsewhere. After removing it the problem is solved.

– pkutp
Nov 23 '18 at 8:05





Thank you. I did define min elsewhere. After removing it the problem is solved.

– pkutp
Nov 23 '18 at 8:05





Popular posts from this blog

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Why https connections are so slow when debugging (stepping over) in Java?