1

I'm using cxxtest4.0.3 under vc6 to do a test. At first, the compiler report strcmp is not a member of std. After I added the CXXTEST_OLD_STD macro to project settings, the compiler report missing type info of string at the line "CXXTEST_STD(string) _s;".

How should I set the macro define? thanks in advanced.

Here is the sample code:

#include <cxxtest/TestSuite.h>
class CSimpleTest : public CxxTest::TestSuite  
{  
public:  
    void testCxx(void){TS_ASSERT(10 == 0); }  
};

Here is the error message:
error C2039: 'strcmp' : is not a member of 'std'
The line in cxxtest\testmain.h report the error message:

if ((CXXTEST_STD(strcmp)(argv[i],"-h")==0) || (CXXTEST_STD(strcmp)(argv[i],"--help")==0)) { 
bucherren
  • 299
  • 1
  • 3
  • 13
  • It's going to sound silly, but have you included the right C++ headers in your test code? Can you show your test code that is running into trouble? – Jonathan Leffler Apr 21 '12 at 17:32

1 Answers1

1

I don't have access to MS Visual Studio 6, but isn't that a little on the archaic side? It was released in June 1998 according to Wikipedia, and the first C++ standard was released in November 1998. So, I would suspect that your C++ compiler is simply too old to be supported by cxxtest.

You could look at the option to cxxgentest:

--no-std              Do not use standard library (even if found in tests).

You can check other options with cxxgentest --help.


It isn't much help to tell you that cxxtest 4.0.3 worked find on MacOS X 10.7.3 with G++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00), but it did — or, at least, your sample program compiled to object file without warnings under:

bin/cxxtestgen -o cxt.cpp test.simple.cpp
g++ -I. -c -Wall -Wextra -o cxt.o cxt.cpp
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
  • The program can't be compiled after I add --no-std option. It can be compiled to object file under vs2005. Perhaps I have to work with a lower version cxxtest under vc6. – bucherren Apr 25 '12 at 09:20
  • You'd be best off working with VS2005 and forgetting about VC6; it belongs on the scrapheap. Or, more charitably perhaps, you should explain why you need to use the archaic version. You might get away with using an older (pre-4.0.x) version of cxxtest; it is certainly worth a try if you really must keep VC6. However, there's a moderate chance that won't work either. – Jonathan Leffler Apr 25 '12 at 13:59
  • In our company we build c++ project with vc6 and build c# project with 2005. Yes, I should work with older version cxxtest. Cxxtest v3.8 works well with vc6. I want to upgrade cxxtest version but it's obviously failed. – bucherren Apr 26 '12 at 01:18
  • It's bad luck that the upgrade doesn't work with VC6. It is good that you have a fallback plan in place. – Jonathan Leffler Apr 26 '12 at 02:37