Warning, /JETSCAPE/external_packages/googletest/googlemock/docs/v1_5/FrequentlyAskedQuestions.md is written in an unsupported language. File is not indexed.
0001
0002
0003 Please send your questions to the
0004 [googlemock](http://groups.google.com/group/googlemock) discussion
0005 group. If you need help with compiler errors, make sure you have
0006 tried [Google Mock Doctor](#How_am_I_supposed_to_make_sense_of_these_horrible_template_error.md) first.
0007
0008 ## I wrote some matchers. After I upgraded to a new version of Google Mock, they no longer compile. What's going on? ##
0009
0010 After version 1.4.0 of Google Mock was released, we had an idea on how
0011 to make it easier to write matchers that can generate informative
0012 messages efficiently. We experimented with this idea and liked what
0013 we saw. Therefore we decided to implement it.
0014
0015 Unfortunately, this means that if you have defined your own matchers
0016 by implementing `MatcherInterface` or using `MakePolymorphicMatcher()`,
0017 your definitions will no longer compile. Matchers defined using the
0018 `MATCHER*` family of macros are not affected.
0019
0020 Sorry for the hassle if your matchers are affected. We believe it's
0021 in everyone's long-term interest to make this change sooner than
0022 later. Fortunately, it's usually not hard to migrate an existing
0023 matcher to the new API. Here's what you need to do:
0024
0025 If you wrote your matcher like this:
0026 ```
0027 // Old matcher definition that doesn't work with the latest
0028 // Google Mock.
0029 using ::testing::MatcherInterface;
0030 ...
0031 class MyWonderfulMatcher : public MatcherInterface<MyType> {
0032 public:
0033 ...
0034 virtual bool Matches(MyType value) const {
0035 // Returns true if value matches.
0036 return value.GetFoo() > 5;
0037 }
0038 ...
0039 };
0040 ```
0041
0042 you'll need to change it to:
0043 ```
0044 // New matcher definition that works with the latest Google Mock.
0045 using ::testing::MatcherInterface;
0046 using ::testing::MatchResultListener;
0047 ...
0048 class MyWonderfulMatcher : public MatcherInterface<MyType> {
0049 public:
0050 ...
0051 virtual bool MatchAndExplain(MyType value,
0052 MatchResultListener* listener) const {
0053 // Returns true if value matches.
0054 return value.GetFoo() > 5;
0055 }
0056 ...
0057 };
0058 ```
0059 (i.e. rename `Matches()` to `MatchAndExplain()` and give it a second
0060 argument of type `MatchResultListener*`.)
0061
0062 If you were also using `ExplainMatchResultTo()` to improve the matcher
0063 message:
0064 ```
0065 // Old matcher definition that doesn't work with the lastest
0066 // Google Mock.
0067 using ::testing::MatcherInterface;
0068 ...
0069 class MyWonderfulMatcher : public MatcherInterface<MyType> {
0070 public:
0071 ...
0072 virtual bool Matches(MyType value) const {
0073 // Returns true if value matches.
0074 return value.GetFoo() > 5;
0075 }
0076
0077 virtual void ExplainMatchResultTo(MyType value,
0078 ::std::ostream* os) const {
0079 // Prints some helpful information to os to help
0080 // a user understand why value matches (or doesn't match).
0081 *os << "the Foo property is " << value.GetFoo();
0082 }
0083 ...
0084 };
0085 ```
0086
0087 you should move the logic of `ExplainMatchResultTo()` into
0088 `MatchAndExplain()`, using the `MatchResultListener` argument where
0089 the `::std::ostream` was used:
0090 ```
0091 // New matcher definition that works with the latest Google Mock.
0092 using ::testing::MatcherInterface;
0093 using ::testing::MatchResultListener;
0094 ...
0095 class MyWonderfulMatcher : public MatcherInterface<MyType> {
0096 public:
0097 ...
0098 virtual bool MatchAndExplain(MyType value,
0099 MatchResultListener* listener) const {
0100 // Returns true if value matches.
0101 *listener << "the Foo property is " << value.GetFoo();
0102 return value.GetFoo() > 5;
0103 }
0104 ...
0105 };
0106 ```
0107
0108 If your matcher is defined using `MakePolymorphicMatcher()`:
0109 ```
0110 // Old matcher definition that doesn't work with the latest
0111 // Google Mock.
0112 using ::testing::MakePolymorphicMatcher;
0113 ...
0114 class MyGreatMatcher {
0115 public:
0116 ...
0117 bool Matches(MyType value) const {
0118 // Returns true if value matches.
0119 return value.GetBar() < 42;
0120 }
0121 ...
0122 };
0123 ... MakePolymorphicMatcher(MyGreatMatcher()) ...
0124 ```
0125
0126 you should rename the `Matches()` method to `MatchAndExplain()` and
0127 add a `MatchResultListener*` argument (the same as what you need to do
0128 for matchers defined by implementing `MatcherInterface`):
0129 ```
0130 // New matcher definition that works with the latest Google Mock.
0131 using ::testing::MakePolymorphicMatcher;
0132 using ::testing::MatchResultListener;
0133 ...
0134 class MyGreatMatcher {
0135 public:
0136 ...
0137 bool MatchAndExplain(MyType value,
0138 MatchResultListener* listener) const {
0139 // Returns true if value matches.
0140 return value.GetBar() < 42;
0141 }
0142 ...
0143 };
0144 ... MakePolymorphicMatcher(MyGreatMatcher()) ...
0145 ```
0146
0147 If your polymorphic matcher uses `ExplainMatchResultTo()` for better
0148 failure messages:
0149 ```
0150 // Old matcher definition that doesn't work with the latest
0151 // Google Mock.
0152 using ::testing::MakePolymorphicMatcher;
0153 ...
0154 class MyGreatMatcher {
0155 public:
0156 ...
0157 bool Matches(MyType value) const {
0158 // Returns true if value matches.
0159 return value.GetBar() < 42;
0160 }
0161 ...
0162 };
0163 void ExplainMatchResultTo(const MyGreatMatcher& matcher,
0164 MyType value,
0165 ::std::ostream* os) {
0166 // Prints some helpful information to os to help
0167 // a user understand why value matches (or doesn't match).
0168 *os << "the Bar property is " << value.GetBar();
0169 }
0170 ... MakePolymorphicMatcher(MyGreatMatcher()) ...
0171 ```
0172
0173 you'll need to move the logic inside `ExplainMatchResultTo()` to
0174 `MatchAndExplain()`:
0175 ```
0176 // New matcher definition that works with the latest Google Mock.
0177 using ::testing::MakePolymorphicMatcher;
0178 using ::testing::MatchResultListener;
0179 ...
0180 class MyGreatMatcher {
0181 public:
0182 ...
0183 bool MatchAndExplain(MyType value,
0184 MatchResultListener* listener) const {
0185 // Returns true if value matches.
0186 *listener << "the Bar property is " << value.GetBar();
0187 return value.GetBar() < 42;
0188 }
0189 ...
0190 };
0191 ... MakePolymorphicMatcher(MyGreatMatcher()) ...
0192 ```
0193
0194 For more information, you can read these
0195 [two](V1_5_CookBook#Writing_New_Monomorphic_Matchers.md)
0196 [recipes](V1_5_CookBook#Writing_New_Polymorphic_Matchers.md)
0197 from the cookbook. As always, you
0198 are welcome to post questions on `googlemock@googlegroups.com` if you
0199 need any help.
0200
0201 ## When using Google Mock, do I have to use Google Test as the testing framework? I have my favorite testing framework and don't want to switch. ##
0202
0203 Google Mock works out of the box with Google Test. However, it's easy
0204 to configure it to work with any testing framework of your choice.
0205 [Here](V1_5_ForDummies#Using_Google_Mock_with_Any_Testing_Framework.md) is how.
0206
0207 ## How am I supposed to make sense of these horrible template errors? ##
0208
0209 If you are confused by the compiler errors gcc threw at you,
0210 try consulting the _Google Mock Doctor_ tool first. What it does is to
0211 scan stdin for gcc error messages, and spit out diagnoses on the
0212 problems (we call them diseases) your code has.
0213
0214 To "install", run command:
0215 ```
0216 alias gmd='<path to googlemock>/scripts/gmock_doctor.py'
0217 ```
0218
0219 To use it, do:
0220 ```
0221 <your-favorite-build-command> <your-test> 2>&1 | gmd
0222 ```
0223
0224 For example:
0225 ```
0226 make my_test 2>&1 | gmd
0227 ```
0228
0229 Or you can run `gmd` and copy-n-paste gcc's error messages to it.
0230
0231 ## Can I mock a variadic function? ##
0232
0233 You cannot mock a variadic function (i.e. a function taking ellipsis
0234 (`...`) arguments) directly in Google Mock.
0235
0236 The problem is that in general, there is _no way_ for a mock object to
0237 know how many arguments are passed to the variadic method, and what
0238 the arguments' types are. Only the _author of the base class_ knows
0239 the protocol, and we cannot look into his head.
0240
0241 Therefore, to mock such a function, the _user_ must teach the mock
0242 object how to figure out the number of arguments and their types. One
0243 way to do it is to provide overloaded versions of the function.
0244
0245 Ellipsis arguments are inherited from C and not really a C++ feature.
0246 They are unsafe to use and don't work with arguments that have
0247 constructors or destructors. Therefore we recommend to avoid them in
0248 C++ as much as possible.
0249
0250 ## MSVC gives me warning C4301 or C4373 when I define a mock method with a const parameter. Why? ##
0251
0252 If you compile this using Microsoft Visual C++ 2005 SP1:
0253 ```
0254 class Foo {
0255 ...
0256 virtual void Bar(const int i) = 0;
0257 };
0258
0259 class MockFoo : public Foo {
0260 ...
0261 MOCK_METHOD1(Bar, void(const int i));
0262 };
0263 ```
0264 You may get the following warning:
0265 ```
0266 warning C4301: 'MockFoo::Bar': overriding virtual function only differs from 'Foo::Bar' by const/volatile qualifier
0267 ```
0268
0269 This is a MSVC bug. The same code compiles fine with gcc ,for
0270 example. If you use Visual C++ 2008 SP1, you would get the warning:
0271 ```
0272 warning C4373: 'MockFoo::Bar': virtual function overrides 'Foo::Bar', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers
0273 ```
0274
0275 In C++, if you _declare_ a function with a `const` parameter, the
0276 `const` modifier is _ignored_. Therefore, the `Foo` base class above
0277 is equivalent to:
0278 ```
0279 class Foo {
0280 ...
0281 virtual void Bar(int i) = 0; // int or const int? Makes no difference.
0282 };
0283 ```
0284
0285 In fact, you can _declare_ Bar() with an `int` parameter, and _define_
0286 it with a `const int` parameter. The compiler will still match them
0287 up.
0288
0289 Since making a parameter `const` is meaningless in the method
0290 _declaration_, we recommend to remove it in both `Foo` and `MockFoo`.
0291 That should workaround the VC bug.
0292
0293 Note that we are talking about the _top-level_ `const` modifier here.
0294 If the function parameter is passed by pointer or reference, declaring
0295 the _pointee_ or _referee_ as `const` is still meaningful. For
0296 example, the following two declarations are _not_ equivalent:
0297 ```
0298 void Bar(int* p); // Neither p nor *p is const.
0299 void Bar(const int* p); // p is not const, but *p is.
0300 ```
0301
0302 ## I have a huge mock class, and Microsoft Visual C++ runs out of memory when compiling it. What can I do? ##
0303
0304 We've noticed that when the `/clr` compiler flag is used, Visual C++
0305 uses 5~6 times as much memory when compiling a mock class. We suggest
0306 to avoid `/clr` when compiling native C++ mocks.
0307
0308 ## I can't figure out why Google Mock thinks my expectations are not satisfied. What should I do? ##
0309
0310 You might want to run your test with
0311 `--gmock_verbose=info`. This flag lets Google Mock print a trace
0312 of every mock function call it receives. By studying the trace,
0313 you'll gain insights on why the expectations you set are not met.
0314
0315 ## How can I assert that a function is NEVER called? ##
0316
0317 ```
0318 EXPECT_CALL(foo, Bar(_))
0319 .Times(0);
0320 ```
0321
0322 ## I have a failed test where Google Mock tells me TWICE that a particular expectation is not satisfied. Isn't this redundant? ##
0323
0324 When Google Mock detects a failure, it prints relevant information
0325 (the mock function arguments, the state of relevant expectations, and
0326 etc) to help the user debug. If another failure is detected, Google
0327 Mock will do the same, including printing the state of relevant
0328 expectations.
0329
0330 Sometimes an expectation's state didn't change between two failures,
0331 and you'll see the same description of the state twice. They are
0332 however _not_ redundant, as they refer to _different points in time_.
0333 The fact they are the same _is_ interesting information.
0334
0335 ## I get a heap check failure when using a mock object, but using a real object is fine. What can be wrong? ##
0336
0337 Does the class (hopefully a pure interface) you are mocking have a
0338 virtual destructor?
0339
0340 Whenever you derive from a base class, make sure its destructor is
0341 virtual. Otherwise Bad Things will happen. Consider the following
0342 code:
0343
0344 ```
0345 class Base {
0346 public:
0347 // Not virtual, but should be.
0348 ~Base() { ... }
0349 ...
0350 };
0351
0352 class Derived : public Base {
0353 public:
0354 ...
0355 private:
0356 std::string value_;
0357 };
0358
0359 ...
0360 Base* p = new Derived;
0361 ...
0362 delete p; // Surprise! ~Base() will be called, but ~Derived() will not
0363 // - value_ is leaked.
0364 ```
0365
0366 By changing `~Base()` to virtual, `~Derived()` will be correctly
0367 called when `delete p` is executed, and the heap checker
0368 will be happy.
0369
0370 ## The "newer expectations override older ones" rule makes writing expectations awkward. Why does Google Mock do that? ##
0371
0372 When people complain about this, often they are referring to code like:
0373
0374 ```
0375 // foo.Bar() should be called twice, return 1 the first time, and return
0376 // 2 the second time. However, I have to write the expectations in the
0377 // reverse order. This sucks big time!!!
0378 EXPECT_CALL(foo, Bar())
0379 .WillOnce(Return(2))
0380 .RetiresOnSaturation();
0381 EXPECT_CALL(foo, Bar())
0382 .WillOnce(Return(1))
0383 .RetiresOnSaturation();
0384 ```
0385
0386 The problem is that they didn't pick the **best** way to express the test's
0387 intent.
0388
0389 By default, expectations don't have to be matched in _any_ particular
0390 order. If you want them to match in a certain order, you need to be
0391 explicit. This is Google Mock's (and jMock's) fundamental philosophy: it's
0392 easy to accidentally over-specify your tests, and we want to make it
0393 harder to do so.
0394
0395 There are two better ways to write the test spec. You could either
0396 put the expectations in sequence:
0397
0398 ```
0399 // foo.Bar() should be called twice, return 1 the first time, and return
0400 // 2 the second time. Using a sequence, we can write the expectations
0401 // in their natural order.
0402 {
0403 InSequence s;
0404 EXPECT_CALL(foo, Bar())
0405 .WillOnce(Return(1))
0406 .RetiresOnSaturation();
0407 EXPECT_CALL(foo, Bar())
0408 .WillOnce(Return(2))
0409 .RetiresOnSaturation();
0410 }
0411 ```
0412
0413 or you can put the sequence of actions in the same expectation:
0414
0415 ```
0416 // foo.Bar() should be called twice, return 1 the first time, and return
0417 // 2 the second time.
0418 EXPECT_CALL(foo, Bar())
0419 .WillOnce(Return(1))
0420 .WillOnce(Return(2))
0421 .RetiresOnSaturation();
0422 ```
0423
0424 Back to the original questions: why does Google Mock search the
0425 expectations (and `ON_CALL`s) from back to front? Because this
0426 allows a user to set up a mock's behavior for the common case early
0427 (e.g. in the mock's constructor or the test fixture's set-up phase)
0428 and customize it with more specific rules later. If Google Mock
0429 searches from front to back, this very useful pattern won't be
0430 possible.
0431
0432 ## Google Mock prints a warning when a function without EXPECT\_CALL is called, even if I have set its behavior using ON\_CALL. Would it be reasonable not to show the warning in this case? ##
0433
0434 When choosing between being neat and being safe, we lean toward the
0435 latter. So the answer is that we think it's better to show the
0436 warning.
0437
0438 Often people write `ON_CALL`s in the mock object's
0439 constructor or `SetUp()`, as the default behavior rarely changes from
0440 test to test. Then in the test body they set the expectations, which
0441 are often different for each test. Having an `ON_CALL` in the set-up
0442 part of a test doesn't mean that the calls are expected. If there's
0443 no `EXPECT_CALL` and the method is called, it's possibly an error. If
0444 we quietly let the call go through without notifying the user, bugs
0445 may creep in unnoticed.
0446
0447 If, however, you are sure that the calls are OK, you can write
0448
0449 ```
0450 EXPECT_CALL(foo, Bar(_))
0451 .WillRepeatedly(...);
0452 ```
0453
0454 instead of
0455
0456 ```
0457 ON_CALL(foo, Bar(_))
0458 .WillByDefault(...);
0459 ```
0460
0461 This tells Google Mock that you do expect the calls and no warning should be
0462 printed.
0463
0464 Also, you can control the verbosity using the `--gmock_verbose` flag.
0465 If you find the output too noisy when debugging, just choose a less
0466 verbose level.
0467
0468 ## How can I delete the mock function's argument in an action? ##
0469
0470 If you find yourself needing to perform some action that's not
0471 supported by Google Mock directly, remember that you can define your own
0472 actions using
0473 [MakeAction()](V1_5_CookBook#Writing_New_Actions.md) or
0474 [MakePolymorphicAction()](V1_5_CookBook#Writing_New_Polymorphic_Actions.md),
0475 or you can write a stub function and invoke it using
0476 [Invoke()](V1_5_CookBook#Using_Functions_Methods_Functors.md).
0477
0478 ## MOCK\_METHODn()'s second argument looks funny. Why don't you use the MOCK\_METHODn(Method, return\_type, arg\_1, ..., arg\_n) syntax? ##
0479
0480 What?! I think it's beautiful. :-)
0481
0482 While which syntax looks more natural is a subjective matter to some
0483 extent, Google Mock's syntax was chosen for several practical advantages it
0484 has.
0485
0486 Try to mock a function that takes a map as an argument:
0487 ```
0488 virtual int GetSize(const map<int, std::string>& m);
0489 ```
0490
0491 Using the proposed syntax, it would be:
0492 ```
0493 MOCK_METHOD1(GetSize, int, const map<int, std::string>& m);
0494 ```
0495
0496 Guess what? You'll get a compiler error as the compiler thinks that
0497 `const map<int, std::string>& m` are **two**, not one, arguments. To work
0498 around this you can use `typedef` to give the map type a name, but
0499 that gets in the way of your work. Google Mock's syntax avoids this
0500 problem as the function's argument types are protected inside a pair
0501 of parentheses:
0502 ```
0503 // This compiles fine.
0504 MOCK_METHOD1(GetSize, int(const map<int, std::string>& m));
0505 ```
0506
0507 You still need a `typedef` if the return type contains an unprotected
0508 comma, but that's much rarer.
0509
0510 Other advantages include:
0511 1. `MOCK_METHOD1(Foo, int, bool)` can leave a reader wonder whether the method returns `int` or `bool`, while there won't be such confusion using Google Mock's syntax.
0512 1. The way Google Mock describes a function type is nothing new, although many people may not be familiar with it. The same syntax was used in C, and the `function` library in `tr1` uses this syntax extensively. Since `tr1` will become a part of the new version of STL, we feel very comfortable to be consistent with it.
0513 1. The function type syntax is also used in other parts of Google Mock's API (e.g. the action interface) in order to make the implementation tractable. A user needs to learn it anyway in order to utilize Google Mock's more advanced features. We'd as well stick to the same syntax in `MOCK_METHOD*`!
0514
0515 ## My code calls a static/global function. Can I mock it? ##
0516
0517 You can, but you need to make some changes.
0518
0519 In general, if you find yourself needing to mock a static function,
0520 it's a sign that your modules are too tightly coupled (and less
0521 flexible, less reusable, less testable, etc). You are probably better
0522 off defining a small interface and call the function through that
0523 interface, which then can be easily mocked. It's a bit of work
0524 initially, but usually pays for itself quickly.
0525
0526 This Google Testing Blog
0527 [post](http://googletesting.blogspot.com/2008/06/defeat-static-cling.html)
0528 says it excellently. Check it out.
0529
0530 ## My mock object needs to do complex stuff. It's a lot of pain to specify the actions. Google Mock sucks! ##
0531
0532 I know it's not a question, but you get an answer for free any way. :-)
0533
0534 With Google Mock, you can create mocks in C++ easily. And people might be
0535 tempted to use them everywhere. Sometimes they work great, and
0536 sometimes you may find them, well, a pain to use. So, what's wrong in
0537 the latter case?
0538
0539 When you write a test without using mocks, you exercise the code and
0540 assert that it returns the correct value or that the system is in an
0541 expected state. This is sometimes called "state-based testing".
0542
0543 Mocks are great for what some call "interaction-based" testing:
0544 instead of checking the system state at the very end, mock objects
0545 verify that they are invoked the right way and report an error as soon
0546 as it arises, giving you a handle on the precise context in which the
0547 error was triggered. This is often more effective and economical to
0548 do than state-based testing.
0549
0550 If you are doing state-based testing and using a test double just to
0551 simulate the real object, you are probably better off using a fake.
0552 Using a mock in this case causes pain, as it's not a strong point for
0553 mocks to perform complex actions. If you experience this and think
0554 that mocks suck, you are just not using the right tool for your
0555 problem. Or, you might be trying to solve the wrong problem. :-)
0556
0557 ## I got a warning "Uninteresting function call encountered - default action taken.." Should I panic? ##
0558
0559 By all means, NO! It's just an FYI.
0560
0561 What it means is that you have a mock function, you haven't set any
0562 expectations on it (by Google Mock's rule this means that you are not
0563 interested in calls to this function and therefore it can be called
0564 any number of times), and it is called. That's OK - you didn't say
0565 it's not OK to call the function!
0566
0567 What if you actually meant to disallow this function to be called, but
0568 forgot to write `EXPECT_CALL(foo, Bar()).Times(0)`? While
0569 one can argue that it's the user's fault, Google Mock tries to be nice and
0570 prints you a note.
0571
0572 So, when you see the message and believe that there shouldn't be any
0573 uninteresting calls, you should investigate what's going on. To make
0574 your life easier, Google Mock prints the function name and arguments
0575 when an uninteresting call is encountered.
0576
0577 ## I want to define a custom action. Should I use Invoke() or implement the action interface? ##
0578
0579 Either way is fine - you want to choose the one that's more convenient
0580 for your circumstance.
0581
0582 Usually, if your action is for a particular function type, defining it
0583 using `Invoke()` should be easier; if your action can be used in
0584 functions of different types (e.g. if you are defining
0585 `Return(value)`), `MakePolymorphicAction()` is
0586 easiest. Sometimes you want precise control on what types of
0587 functions the action can be used in, and implementing
0588 `ActionInterface` is the way to go here. See the implementation of
0589 `Return()` in `include/gmock/gmock-actions.h` for an example.
0590
0591 ## I'm using the set-argument-pointee action, and the compiler complains about "conflicting return type specified". What does it mean? ##
0592
0593 You got this error as Google Mock has no idea what value it should return
0594 when the mock method is called. `SetArgumentPointee()` says what the
0595 side effect is, but doesn't say what the return value should be. You
0596 need `DoAll()` to chain a `SetArgumentPointee()` with a `Return()`.
0597
0598 See this [recipe](V1_5_CookBook#Mocking_Side_Effects.md) for more details and an example.
0599
0600
0601 ## My question is not in your FAQ! ##
0602
0603 If you cannot find the answer to your question in this FAQ, there are
0604 some other resources you can use:
0605
0606 1. read other [wiki pages](http://code.google.com/p/googlemock/w/list),
0607 1. search the mailing list [archive](http://groups.google.com/group/googlemock/topics),
0608 1. ask it on [googlemock@googlegroups.com](mailto:googlemock@googlegroups.com) and someone will answer it (to prevent spam, we require you to join the [discussion group](http://groups.google.com/group/googlemock) before you can post.).
0609
0610 Please note that creating an issue in the
0611 [issue tracker](http://code.google.com/p/googlemock/issues/list) is _not_
0612 a good way to get your answer, as it is monitored infrequently by a
0613 very small number of people.
0614
0615 When asking a question, it's helpful to provide as much of the
0616 following information as possible (people cannot help you if there's
0617 not enough information in your question):
0618
0619 * the version (or the revision number if you check out from SVN directly) of Google Mock you use (Google Mock is under active development, so it's possible that your problem has been solved in a later version),
0620 * your operating system,
0621 * the name and version of your compiler,
0622 * the complete command line flags you give to your compiler,
0623 * the complete compiler error messages (if the question is about compilation),
0624 * the _actual_ code (ideally, a minimal but complete program) that has the problem you encounter.