• Advertisement

Archived

This topic is now archived and is closed to further replies.

can C++ have struct ?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

i have this,
#include <vector>
using namespace std;
struct connections{
  int toLayer;
  int toNeuron;
};
class neuron
{
private:
  vector<connections>   map;
.....etc.
};
[\source]

and then link with another file and start having strange things like "underclaered identifier".... and thing''s like that... :)

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
A struct is just a class in which members default to public.

Share this post


Link to post
Share on other sites
Thanks SiCrane, but this doesn''t help...



I know the code sort of work. Coz i have them compiler sepearely. To test out each class... They all work, until i #include them together...

And one of the error saying "std::vector: use of class template requires tamplate argument list"...? What is that???


Thanks again

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you''re getting errors when you include them together, I think your problem would most likely be an include loop, i.e. one of your header files is being included twice in some of your files which results in the including going back and forth

Make sure you''re only including your header files once if possible

Share this post


Link to post
Share on other sites
quote:
Original post by NewbieA
Thanks SiCrane, but this doesn''t help...



I know the code sort of work. Coz i have them compiler sepearely. To test out each class... They all work, until i #include them together...

And one of the error saying "std::vector: use of class template requires tamplate argument list"...? What is that???


Thanks again


I can bet that article will address your issue. You just need to read it a bit more thoroughly.

Share this post


Link to post
Share on other sites
add some multiinclusinprotection:

#ifndef _BLA_H_INCLUDED
#define _BLA_H_INCLUDED

// code goes here


#endif

Share this post


Link to post
Share on other sites

  • Advertisement