0

I am trying to run some simple gtest tests on an AIX machine:

#include <gtest/gtest.h>
 
int add(int a, int b) {
    return a + b;
}
 
// Test case to check addition function
TEST(AdditionTest, PositiveNumbers) {
    EXPECT_EQ(add(2, 3), 5);
    EXPECT_EQ(add(-2, 3), 1);
    EXPECT_EQ(add(-2, -3), -5);
}
 
int main(int argc, char **argv) {
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}

$path looks like:

/usr/bin /etc /usr/sbin /usr/ucb /usr/bin/X11 /sbin /usr/java5/jre/bin /usr/java5/bin /usr/local/bin /mei_commands /wcsbin/com /wcsbin /opt/freeware/bin /usr/local/bin /bin /usr/bin /etc /usr/etc /rgti/test/bin /rgti/test/com /opt/freeware/include/gtest/ /opt/freeware/include

swarnagowri.bs > which cc
/usr/bin/cc
======================================
swarnagowri.bs > uname -a
AIX <server_name> 2 7 00C995884C00

Here is the command we are running to get it compiled:

cc hello_world.cpp /usr/lib/libC.a /opt/freeware/lib/libgtest.a /opt/freeware/lib/libgtestmain.a

But I keep getting:

"hello_world.cpp", line 2.10: 1540-0836 (S) The #include file <gtest/gtest.h> is not found.

Running with -I/opt/freeware/include added in the compilation command gives:

lingaraj.gondakar > cc hello_world.cpp /usr/lib/libC.a -I/opt/freeware/include
"/opt/IBM/xlC/16.1.0/include/tuple", line 68.5: 1540-0859 (S) #error directive: To use the tuple library, macro __IBMCPP_TR1__ must be defined
by user to non zero integer value..
"/opt/IBM/xlC/16.1.0/include/type_traits", line 315.5: 1540-0859 (S) #error directive: To use the type traits library, macro __IBMCPP_TR1__ must be defined
by user to non zero integer value..
"/opt/freeware/include/gtest/gtest-matchers.h", line 42.10: 1540-0836 (S) The #include file <atomic> is not found.
"/opt/freeware/include/gtest/internal/gtest-port.h", line 279.2: 1540-0859 (S) #error directive: C++ versions less than C++14 are not supported..
lingaraj @ wcsdev:/home/mouser.lan/lingaraj.gondakar/Code/wcs/code
lingaraj.gondakar >

Could you please help - thanks!

7
  • We got gtest-1.14.0-1.ppc-1.ppc(gtest-1.14.0-1.aix7.1.ppc.rpm) and gtest-devel-1.14.0-1.ppc(gtest-devel-1.14.0-1.aix7.1.ppc.rpm) Commented Jun 19 at 7:12
  • Add flag -I/opt/freeware/include into your compile command. Commented Jun 19 at 7:29
  • I get compilation errors, that are too long to be pasted here, pasting on the question itself. Commented Jun 19 at 12:08
  • Try adding #define __IBMCPP_TR1__ 1 at the top of your code. Not sure about the other errors. They look pretty self-explanatory. It used to be that ittoolbox.com had more AIX people. Also the IBM support forums had (have) knowledgeable people. Good luck.
    – shellter
    Commented Jun 19 at 13:29
  • 1
    @OP Success? Failure? Lost interest? Commented Aug 1 at 7:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.