jinxuan / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

ASSERT_EQ redefinition problem #352

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
1. Compile gtest as per directions.
2. Create a unit test in our environment.
3. Attempt to compile.

What is the expected output? What do you see instead?
We expected a successful compile. However, our system already has macro 
definitions for the ASSERT_EQ, ASSERT_NE, ASSERT_LT, ... This leads to compiler 
redefinition errors.

What version of Google Test are you using? On what operating system?
gtest-1.5.0 on Red Hat Enterprise Linux Server release 5.4 (Tikanga).

Please provide any additional information below, such as a code snippet.
For now I used sed to change all ASSERT_ to GASSERT_ in the gtest distribution. 
This works. Now we must remember to make similar changes for any future google 
test updates.

Ideally I would like something similar used to handle the 
-DGTEST_DONT_DEFINE_SUCEED=1 for SUCCEED and FAIL.

Does anyone have a better idea? 

Original issue reported on code.google.com by Trailing...@gmail.com on 12 Jan 2011 at 4:14

GoogleCodeExporter commented 9 years ago
I have added a FAQ entry 
(http://code.google.com/p/googletest/wiki/FAQ#Google_Test_defines_a_macro_that_c
lashes_with_one_defined_by_ano) to make the macro clash information more 
prominent.

Original comment by vladlosev on 13 Jan 2011 at 9:52

GoogleCodeExporter commented 9 years ago
Thanks for the information but this must be for an earlier version. We're using 
gtest-1.5.0 and the README specifically states -DGTEST_DONT_DEFINE_FOO=1 ... 
Currently FOO can be FAIL, SUCCEED or TEST.

Renaming the macros such as ASSERT_EQ requires checking out the latest test 
project source code at http://code.google.com/p/googletest/source/checkout . 
This feature will likely be in 1.5.1  

But thanks once again for the tip! :)

Original comment by Trailing...@gmail.com on 14 Jan 2011 at 5:36