Menu
  • HOME
  • TAGS

c++ Why is variable “file” undeclared when I have declared it? [closed]

c++,variables,ofstream,undeclared-identifier

You are trying to access the file variable outside the conditional branches where its life is over. When you declare them within the { ... } conditional blocks, it will go out of scope at the closing bracket. The proper solution would be either to declare it in the beginning...

What is wrong that shows “Use of undeclared type” after adding an function?

ios,objective-c,swift,undeclared-identifier

The problem is that you define a method with the same name SACalendar as an existing class. This instance method "hides" the class definition within class Calendar. Renaming func SACalendar(...) should solve the problem....

How to use and make a GLOBAL variable to use in different functions?

c++,variables,compiler-errors,global,undeclared-identifier

Here's an idea for you (because, as you said, you shouldn't use globals unless absolutely necessary, and in your case, it's not necessary): 1.Create a class ingredient: class ingredient { public: string name; string unit; double quantity; ingredient(string n, string u, double q) : name(n), unit(u), quantity(q) { } }...

Queue Pointers and values not declared

c++,compiler-errors,queue,undeclared-identifier

Why do you need constant method delcarations? I would get rid of const() completely on all of your methods. A couple of other things that are likely problematic: get_totalWait() has a void return type, you probably want either int or double for that. It's hard to know what else might...