This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I gettin not declared in this scope error msg also declared .h file & EngineFactory class in .h
EngineFactory *engineFactory = NULL;
engineFactory = new EngineFactory();
EngineFactory->Create();
EngineFactory->destroy();
There is two problems in the code:
Your code is not inside a function. Place it in main() function, and it'll work better.
EngineFactory->Create(); has uppercase EngineFactory, while your variable is lowercase.
Related
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I am inserting 'this' pointer into a map
Does it cause a segmentation fault
My code is
client->commandHandlerMap.insert(std::pair<CommandType , CommandHandler*>(CommandType::OrderBookCommandType , this));
I am doing this inside the member function of a derived class of CommandHandler
I would assume that client is not initialized or has an invalid pointer.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I found a C++ file in PARSEC benchmark suite and saw some functions like this:
long Rng::rand()
{
return _rng->randInt();
}
what does the :: in the name of the function do here?
In C, :: is a syntax error unless it occurs inside a comment, a character literal or a string literal.
The :: can only appear in C++ code.
In C++ :: is the Scope resolution operator.
In this case it tells the compiler that it is a defintiion for rand() method which is a member function for Rng class/structure/union/namespace.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I have the following class:
class clsTree;
{
private:
vector<clsNode*>m_content;
m_RootNode *clsNode;
m_LastNode *clsNode;
public:
vector<clsNode*>Content;
wstring interpret(wstring uWord);
};
The compiler does not like my member declaration of clsNode at all.
The first error I get is "Member clsTree::clsNode is not a type name.".
I don't see where I went wrong.
Can somebody help, please?
You're not showing the definition of clsNode, neither whether you have a forward declaration for it, but I'm pretty sure this:
m_RootNode *clsNode;
m_LastNode *clsNode;
Should be rewritten this way:
clsNode* m_RootNode;
clsNode* m_LastNode;
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I am modifying some C++ code that has a wchar_t myArray[MAX_PATH] in the header file.
My modifications mean that I cannot know the length of this array until runtime. How can I store an array of dynamic length instead? Maybe I just keep a wchar_t* in the header file and another int to hold its length?
Use std::wstring instead. It's a dynamic string containing wchar_t.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
Ogre::any_cast<std::map<Rail>::iterator>
It takes Ogre::any_cast<std::map<Rail> and says too few arguments etc. How can I fix it (other than obvious typedef aliasing)?
The problem is that std::map takes at least two template arguments - the key type and the value type. Currently you have std::map<Rail>. What are you mapping from Rail to? For example, this would be okay if your iterators are for a std::map that maps from Rail to int (assuming Rail is not a deduced type):
Ogre::any_cast<std::map<Rail,int>::iterator>(some_any_object)