Howto install google-mock on Ubuntu 12.10Cant install ubuntu 12.10?How to install Gyachi on ubuntu 12.10Ubuntu 12.10 Install IssuesUbuntu 12.10 InstallCannot install Ubuntu 12.10Install Ubuntu 12.10install google earth on ubuntu 12.10What's a good way to mock a remote HTTPS API for unit testing my QML app?

Professional Edition + Web Services API for a third-party website

Why do HK chefs use a white cloth to clutch wok?

How to equalize the chance of throwing the highest dice? (Riddle)

Back with another one-line wonder!

What will happen to a ball kept on a frictionless inclined plane?

Exactly what color was the text on monochrome terminals with green-on-black and amber-on-black screens?

How did LM circuit breakers operate? (famous engine arm CB broken by Aldrin)

Is it necessary to wipe out vile man-eating dragons?

Inverse Look-and-Say

How can medieval knights protects themselves against modern guns?

Do Klingons have escape pods?

Repairing a notched floor joist

Why is it so important who the whistleblower in the Trump-Zelensky phone call is?

What can I do if one employer used offer letter from first company against me?

What is a flight ticket coupon?

What does "Massage with salt" mean in a recipe?

Does the "reappearing" property of the "Shadowneedle" Unbreakable Arrow function?

Representation of bromelain molecule in two dimensional diagram

Simulate reproduction in a population of oozes

Using nicht where kein should be

Why don't electrical receptacles have more than one ground?

Memory models for assembly libraries for Turbo C

If I have fewer than 6 Pokemon in my party, does each gain more EXP?

Large products with glass doors



Howto install google-mock on Ubuntu 12.10


Cant install ubuntu 12.10?How to install Gyachi on ubuntu 12.10Ubuntu 12.10 Install IssuesUbuntu 12.10 InstallCannot install Ubuntu 12.10Install Ubuntu 12.10install google earth on ubuntu 12.10What's a good way to mock a remote HTTPS API for unit testing my QML app?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









6


















I am having hard time trying to install Google C++ Mocking Framework. I have successfully run sudo apt-get install google-mock. Then I tried to compile this sample file



#include "gmock/gmock.h"
int main(int argc, char** argv)
::testing::InitGoogleMock(&argc, argv);
return RUN_ALL_TESTS();



with g++ -lgmock main.cpp and these errors have shown



main.cpp:(.text+0x1e): undefined reference to `testing::InitGoogleMock(int*, char**)'
main.cpp:(.text+0x23): undefined reference to `testing::UnitTest::GetInstance()'
main.cpp:(.text+0x2b): undefined reference to `testing::UnitTest::Run()'
collect2: error: ld returned 1 exit status


I guess the linker can not find the library files. Does anybody know how to fix this?










share|improve this question

































    6


















    I am having hard time trying to install Google C++ Mocking Framework. I have successfully run sudo apt-get install google-mock. Then I tried to compile this sample file



    #include "gmock/gmock.h"
    int main(int argc, char** argv)
    ::testing::InitGoogleMock(&argc, argv);
    return RUN_ALL_TESTS();



    with g++ -lgmock main.cpp and these errors have shown



    main.cpp:(.text+0x1e): undefined reference to `testing::InitGoogleMock(int*, char**)'
    main.cpp:(.text+0x23): undefined reference to `testing::UnitTest::GetInstance()'
    main.cpp:(.text+0x2b): undefined reference to `testing::UnitTest::Run()'
    collect2: error: ld returned 1 exit status


    I guess the linker can not find the library files. Does anybody know how to fix this?










    share|improve this question





























      6













      6









      6


      2






      I am having hard time trying to install Google C++ Mocking Framework. I have successfully run sudo apt-get install google-mock. Then I tried to compile this sample file



      #include "gmock/gmock.h"
      int main(int argc, char** argv)
      ::testing::InitGoogleMock(&argc, argv);
      return RUN_ALL_TESTS();



      with g++ -lgmock main.cpp and these errors have shown



      main.cpp:(.text+0x1e): undefined reference to `testing::InitGoogleMock(int*, char**)'
      main.cpp:(.text+0x23): undefined reference to `testing::UnitTest::GetInstance()'
      main.cpp:(.text+0x2b): undefined reference to `testing::UnitTest::Run()'
      collect2: error: ld returned 1 exit status


      I guess the linker can not find the library files. Does anybody know how to fix this?










      share|improve this question
















      I am having hard time trying to install Google C++ Mocking Framework. I have successfully run sudo apt-get install google-mock. Then I tried to compile this sample file



      #include "gmock/gmock.h"
      int main(int argc, char** argv)
      ::testing::InitGoogleMock(&argc, argv);
      return RUN_ALL_TESTS();



      with g++ -lgmock main.cpp and these errors have shown



      main.cpp:(.text+0x1e): undefined reference to `testing::InitGoogleMock(int*, char**)'
      main.cpp:(.text+0x23): undefined reference to `testing::UnitTest::GetInstance()'
      main.cpp:(.text+0x2b): undefined reference to `testing::UnitTest::Run()'
      collect2: error: ld returned 1 exit status


      I guess the linker can not find the library files. Does anybody know how to fix this?







      installation programming c++ testing






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 19 '12 at 23:07







      Slazer

















      asked Nov 19 '12 at 22:36









      SlazerSlazer

      3592 gold badges5 silver badges15 bronze badges




      3592 gold badges5 silver badges15 bronze badges























          4 Answers
          4






          active

          oldest

          votes


















          7



















          OK, I've now successfully started using gmock by building my own version as per the README provided with the source download from googlemock project website.



          Get the download zip from the website:
          http://code.google.com/p/googlemock/downloads/list



          Unzip this to a directory, say $GMOCK_ROOT. Then, as per README instructions:



          cd $GMOCK_ROOT
          mkdir build
          cd build
          g++ -I../gtest/include -I../gtest -I../include -I.. -c ../gtest/src/gtest-all.cc
          g++ -I../gtest/include -I../gtest -I../include -I.. -c ../src/gmock-all.cc
          ar -rv libgmock.a gtest-all.o gmock-all.o


          Thus you have your own libgmock.a in $GMOCK_ROOT/build. You actually also need pthreads to compile, so your compile command after that becomes:



          g++ -I$GMOCK_ROOT/include/ main.cpp -L$GMOCK_ROOT/build -lgmock -lpthread





          share|improve this answer




























          • Confirmed that it works. Goog job! I just wonder why is the order of g++'s parameters important.

            – Slazer
            Nov 28 '12 at 19:36


















          3



















          libgmock-dev will be included in the default Ubuntu 18.10 repositories, Otherwise in earlier Ubuntu releases you have to manually download and install it.



          sudo apt-get install libgmock-dev
          cd /usr/src/gmock
          sudo mkdir build
          sudo cmake ..
          sudo make
          sudo cp *.a /usr/lib





          share|improve this answer




























          • make sure you add detailed explanation of what you are suggesting the user tries.

            – Juan Antonio
            May 23 '18 at 16:48


















          2



















          To give context to Pavel's answer, the compiled Google Mock binary is not distributed with the Ubuntu package because of the reason given here. This explanation is for Google Test, but the principle applies to any C++ library.



          Specifically, it says:




          In the early days, we said that you could install compiled Google Test
          libraries on *nix systems using make install. Then every user of your
          machine can write tests without recompiling Google Test.



          This seemed like a good idea, but it has a got-cha: every user needs
          to compile his tests using the same compiler flags used to compile the
          installed Google Test libraries; otherwise he may run into undefined
          behaviors (i.e. the tests can behave strangely and may even crash for
          no obvious reasons).



          Why? Because C++ has this thing called the One-Definition Rule: if two
          C++ source files contain different definitions of the same
          class/function/variable, and you link them together, you violate the
          rule. The linker may or may not catch the error (in many cases it's
          not required by the C++ standard to catch the violation). If it
          doesn't, you get strange run-time behaviors that are unexpected and
          hard to debug.



          If you compile Google Test and your test code using different compiler
          flags, they may see different definitions of the same
          class/function/variable (e.g. due to the use of #if in Google Test).
          Therefore, for your sanity, we recommend to avoid installing
          pre-compiled Google Test libraries. Instead, each project should
          compile Google Test itself such that it can be sure that the same
          flags are used for both Google Test and the tests.




          So your original problem was because installing the google-mock package only installed the source code, and when you tried to compile your sample application, no gmock library could be found.






          share|improve this answer





















          • 4





            I wonder why is this so. There are many C++ libraries that work precompiled inside /lib.

            – Slazer
            Nov 28 '12 at 19:39


















          0



















          In total, i use two installation methods, but in the second method you need to create the 'CMakeLists.txt' (where the data of your project will be indicated, subdirectory) file yourself and put it in the '/root/my_build directory'. I needed to uninstall the old version of 'cmake' and install a new one. I tried to install on Ubuntu 18.04.3 LTS 'gmock' on the root and everything related to its installation.



          method 1:



          # apt search gmock



          # apt-get installyour version gmock



          method 2:



          # apt install unzip



          # wget https://github.com/cfmobile/gmock/archive/master.zip



          # unzip master.zip -d /$GMOCK_ROOT



          # cd $GMOCK_ROOT



          # mkdir my_build



          # cd my_build



          # cmake ..



          # cd .. (exit from my_build, if 'CMakeLists.txt' not found, you must create it
          yourself).



          find and delete the old version cmake:



          # apt list --installed | grep cmake



          # apt-get remove cmake



          # cmake --version



          # reboot



          install new version cmake:



          # wget https://github.com/Kitware/CMake/releases/download/v3.15.3/cmake-3.15.3.tar.gz



          # tar -zxvf cmake-3.15.3.tar.gz



          # cd cmake-3.15.3



          # ./configure



          # make



          # make install



          # reboot



          again go back to /root/my_build:



          # cd my_build



          # cmake ..



          # make --jobs 4



          # cd $GMOCK_HOME/gtest



          # mkdir



          # cd my_build



          # cmake ..



          # make --jobs 4






          share|improve this answer





























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );














            draft saved

            draft discarded
















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f219516%2fhowto-install-google-mock-on-ubuntu-12-10%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown


























            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            7



















            OK, I've now successfully started using gmock by building my own version as per the README provided with the source download from googlemock project website.



            Get the download zip from the website:
            http://code.google.com/p/googlemock/downloads/list



            Unzip this to a directory, say $GMOCK_ROOT. Then, as per README instructions:



            cd $GMOCK_ROOT
            mkdir build
            cd build
            g++ -I../gtest/include -I../gtest -I../include -I.. -c ../gtest/src/gtest-all.cc
            g++ -I../gtest/include -I../gtest -I../include -I.. -c ../src/gmock-all.cc
            ar -rv libgmock.a gtest-all.o gmock-all.o


            Thus you have your own libgmock.a in $GMOCK_ROOT/build. You actually also need pthreads to compile, so your compile command after that becomes:



            g++ -I$GMOCK_ROOT/include/ main.cpp -L$GMOCK_ROOT/build -lgmock -lpthread





            share|improve this answer




























            • Confirmed that it works. Goog job! I just wonder why is the order of g++'s parameters important.

              – Slazer
              Nov 28 '12 at 19:36















            7



















            OK, I've now successfully started using gmock by building my own version as per the README provided with the source download from googlemock project website.



            Get the download zip from the website:
            http://code.google.com/p/googlemock/downloads/list



            Unzip this to a directory, say $GMOCK_ROOT. Then, as per README instructions:



            cd $GMOCK_ROOT
            mkdir build
            cd build
            g++ -I../gtest/include -I../gtest -I../include -I.. -c ../gtest/src/gtest-all.cc
            g++ -I../gtest/include -I../gtest -I../include -I.. -c ../src/gmock-all.cc
            ar -rv libgmock.a gtest-all.o gmock-all.o


            Thus you have your own libgmock.a in $GMOCK_ROOT/build. You actually also need pthreads to compile, so your compile command after that becomes:



            g++ -I$GMOCK_ROOT/include/ main.cpp -L$GMOCK_ROOT/build -lgmock -lpthread





            share|improve this answer




























            • Confirmed that it works. Goog job! I just wonder why is the order of g++'s parameters important.

              – Slazer
              Nov 28 '12 at 19:36













            7















            7











            7









            OK, I've now successfully started using gmock by building my own version as per the README provided with the source download from googlemock project website.



            Get the download zip from the website:
            http://code.google.com/p/googlemock/downloads/list



            Unzip this to a directory, say $GMOCK_ROOT. Then, as per README instructions:



            cd $GMOCK_ROOT
            mkdir build
            cd build
            g++ -I../gtest/include -I../gtest -I../include -I.. -c ../gtest/src/gtest-all.cc
            g++ -I../gtest/include -I../gtest -I../include -I.. -c ../src/gmock-all.cc
            ar -rv libgmock.a gtest-all.o gmock-all.o


            Thus you have your own libgmock.a in $GMOCK_ROOT/build. You actually also need pthreads to compile, so your compile command after that becomes:



            g++ -I$GMOCK_ROOT/include/ main.cpp -L$GMOCK_ROOT/build -lgmock -lpthread





            share|improve this answer
















            OK, I've now successfully started using gmock by building my own version as per the README provided with the source download from googlemock project website.



            Get the download zip from the website:
            http://code.google.com/p/googlemock/downloads/list



            Unzip this to a directory, say $GMOCK_ROOT. Then, as per README instructions:



            cd $GMOCK_ROOT
            mkdir build
            cd build
            g++ -I../gtest/include -I../gtest -I../include -I.. -c ../gtest/src/gtest-all.cc
            g++ -I../gtest/include -I../gtest -I../include -I.. -c ../src/gmock-all.cc
            ar -rv libgmock.a gtest-all.o gmock-all.o


            Thus you have your own libgmock.a in $GMOCK_ROOT/build. You actually also need pthreads to compile, so your compile command after that becomes:



            g++ -I$GMOCK_ROOT/include/ main.cpp -L$GMOCK_ROOT/build -lgmock -lpthread






            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited Nov 21 '12 at 13:58

























            answered Nov 21 '12 at 11:37









            PavelPavel

            862 bronze badges




            862 bronze badges















            • Confirmed that it works. Goog job! I just wonder why is the order of g++'s parameters important.

              – Slazer
              Nov 28 '12 at 19:36

















            • Confirmed that it works. Goog job! I just wonder why is the order of g++'s parameters important.

              – Slazer
              Nov 28 '12 at 19:36
















            Confirmed that it works. Goog job! I just wonder why is the order of g++'s parameters important.

            – Slazer
            Nov 28 '12 at 19:36





            Confirmed that it works. Goog job! I just wonder why is the order of g++'s parameters important.

            – Slazer
            Nov 28 '12 at 19:36













            3



















            libgmock-dev will be included in the default Ubuntu 18.10 repositories, Otherwise in earlier Ubuntu releases you have to manually download and install it.



            sudo apt-get install libgmock-dev
            cd /usr/src/gmock
            sudo mkdir build
            sudo cmake ..
            sudo make
            sudo cp *.a /usr/lib





            share|improve this answer




























            • make sure you add detailed explanation of what you are suggesting the user tries.

              – Juan Antonio
              May 23 '18 at 16:48















            3



















            libgmock-dev will be included in the default Ubuntu 18.10 repositories, Otherwise in earlier Ubuntu releases you have to manually download and install it.



            sudo apt-get install libgmock-dev
            cd /usr/src/gmock
            sudo mkdir build
            sudo cmake ..
            sudo make
            sudo cp *.a /usr/lib





            share|improve this answer




























            • make sure you add detailed explanation of what you are suggesting the user tries.

              – Juan Antonio
              May 23 '18 at 16:48













            3















            3











            3









            libgmock-dev will be included in the default Ubuntu 18.10 repositories, Otherwise in earlier Ubuntu releases you have to manually download and install it.



            sudo apt-get install libgmock-dev
            cd /usr/src/gmock
            sudo mkdir build
            sudo cmake ..
            sudo make
            sudo cp *.a /usr/lib





            share|improve this answer
















            libgmock-dev will be included in the default Ubuntu 18.10 repositories, Otherwise in earlier Ubuntu releases you have to manually download and install it.



            sudo apt-get install libgmock-dev
            cd /usr/src/gmock
            sudo mkdir build
            sudo cmake ..
            sudo make
            sudo cp *.a /usr/lib






            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited May 23 '18 at 19:48









            karel

            70.8k15 gold badges159 silver badges184 bronze badges




            70.8k15 gold badges159 silver badges184 bronze badges










            answered May 23 '18 at 16:40









            SteephenSteephen

            1312 bronze badges




            1312 bronze badges















            • make sure you add detailed explanation of what you are suggesting the user tries.

              – Juan Antonio
              May 23 '18 at 16:48

















            • make sure you add detailed explanation of what you are suggesting the user tries.

              – Juan Antonio
              May 23 '18 at 16:48
















            make sure you add detailed explanation of what you are suggesting the user tries.

            – Juan Antonio
            May 23 '18 at 16:48





            make sure you add detailed explanation of what you are suggesting the user tries.

            – Juan Antonio
            May 23 '18 at 16:48











            2



















            To give context to Pavel's answer, the compiled Google Mock binary is not distributed with the Ubuntu package because of the reason given here. This explanation is for Google Test, but the principle applies to any C++ library.



            Specifically, it says:




            In the early days, we said that you could install compiled Google Test
            libraries on *nix systems using make install. Then every user of your
            machine can write tests without recompiling Google Test.



            This seemed like a good idea, but it has a got-cha: every user needs
            to compile his tests using the same compiler flags used to compile the
            installed Google Test libraries; otherwise he may run into undefined
            behaviors (i.e. the tests can behave strangely and may even crash for
            no obvious reasons).



            Why? Because C++ has this thing called the One-Definition Rule: if two
            C++ source files contain different definitions of the same
            class/function/variable, and you link them together, you violate the
            rule. The linker may or may not catch the error (in many cases it's
            not required by the C++ standard to catch the violation). If it
            doesn't, you get strange run-time behaviors that are unexpected and
            hard to debug.



            If you compile Google Test and your test code using different compiler
            flags, they may see different definitions of the same
            class/function/variable (e.g. due to the use of #if in Google Test).
            Therefore, for your sanity, we recommend to avoid installing
            pre-compiled Google Test libraries. Instead, each project should
            compile Google Test itself such that it can be sure that the same
            flags are used for both Google Test and the tests.




            So your original problem was because installing the google-mock package only installed the source code, and when you tried to compile your sample application, no gmock library could be found.






            share|improve this answer





















            • 4





              I wonder why is this so. There are many C++ libraries that work precompiled inside /lib.

              – Slazer
              Nov 28 '12 at 19:39















            2



















            To give context to Pavel's answer, the compiled Google Mock binary is not distributed with the Ubuntu package because of the reason given here. This explanation is for Google Test, but the principle applies to any C++ library.



            Specifically, it says:




            In the early days, we said that you could install compiled Google Test
            libraries on *nix systems using make install. Then every user of your
            machine can write tests without recompiling Google Test.



            This seemed like a good idea, but it has a got-cha: every user needs
            to compile his tests using the same compiler flags used to compile the
            installed Google Test libraries; otherwise he may run into undefined
            behaviors (i.e. the tests can behave strangely and may even crash for
            no obvious reasons).



            Why? Because C++ has this thing called the One-Definition Rule: if two
            C++ source files contain different definitions of the same
            class/function/variable, and you link them together, you violate the
            rule. The linker may or may not catch the error (in many cases it's
            not required by the C++ standard to catch the violation). If it
            doesn't, you get strange run-time behaviors that are unexpected and
            hard to debug.



            If you compile Google Test and your test code using different compiler
            flags, they may see different definitions of the same
            class/function/variable (e.g. due to the use of #if in Google Test).
            Therefore, for your sanity, we recommend to avoid installing
            pre-compiled Google Test libraries. Instead, each project should
            compile Google Test itself such that it can be sure that the same
            flags are used for both Google Test and the tests.




            So your original problem was because installing the google-mock package only installed the source code, and when you tried to compile your sample application, no gmock library could be found.






            share|improve this answer





















            • 4





              I wonder why is this so. There are many C++ libraries that work precompiled inside /lib.

              – Slazer
              Nov 28 '12 at 19:39













            2















            2











            2









            To give context to Pavel's answer, the compiled Google Mock binary is not distributed with the Ubuntu package because of the reason given here. This explanation is for Google Test, but the principle applies to any C++ library.



            Specifically, it says:




            In the early days, we said that you could install compiled Google Test
            libraries on *nix systems using make install. Then every user of your
            machine can write tests without recompiling Google Test.



            This seemed like a good idea, but it has a got-cha: every user needs
            to compile his tests using the same compiler flags used to compile the
            installed Google Test libraries; otherwise he may run into undefined
            behaviors (i.e. the tests can behave strangely and may even crash for
            no obvious reasons).



            Why? Because C++ has this thing called the One-Definition Rule: if two
            C++ source files contain different definitions of the same
            class/function/variable, and you link them together, you violate the
            rule. The linker may or may not catch the error (in many cases it's
            not required by the C++ standard to catch the violation). If it
            doesn't, you get strange run-time behaviors that are unexpected and
            hard to debug.



            If you compile Google Test and your test code using different compiler
            flags, they may see different definitions of the same
            class/function/variable (e.g. due to the use of #if in Google Test).
            Therefore, for your sanity, we recommend to avoid installing
            pre-compiled Google Test libraries. Instead, each project should
            compile Google Test itself such that it can be sure that the same
            flags are used for both Google Test and the tests.




            So your original problem was because installing the google-mock package only installed the source code, and when you tried to compile your sample application, no gmock library could be found.






            share|improve this answer














            To give context to Pavel's answer, the compiled Google Mock binary is not distributed with the Ubuntu package because of the reason given here. This explanation is for Google Test, but the principle applies to any C++ library.



            Specifically, it says:




            In the early days, we said that you could install compiled Google Test
            libraries on *nix systems using make install. Then every user of your
            machine can write tests without recompiling Google Test.



            This seemed like a good idea, but it has a got-cha: every user needs
            to compile his tests using the same compiler flags used to compile the
            installed Google Test libraries; otherwise he may run into undefined
            behaviors (i.e. the tests can behave strangely and may even crash for
            no obvious reasons).



            Why? Because C++ has this thing called the One-Definition Rule: if two
            C++ source files contain different definitions of the same
            class/function/variable, and you link them together, you violate the
            rule. The linker may or may not catch the error (in many cases it's
            not required by the C++ standard to catch the violation). If it
            doesn't, you get strange run-time behaviors that are unexpected and
            hard to debug.



            If you compile Google Test and your test code using different compiler
            flags, they may see different definitions of the same
            class/function/variable (e.g. due to the use of #if in Google Test).
            Therefore, for your sanity, we recommend to avoid installing
            pre-compiled Google Test libraries. Instead, each project should
            compile Google Test itself such that it can be sure that the same
            flags are used for both Google Test and the tests.




            So your original problem was because installing the google-mock package only installed the source code, and when you tried to compile your sample application, no gmock library could be found.







            share|improve this answer













            share|improve this answer




            share|improve this answer










            answered Nov 25 '12 at 14:58







            user2405user2405

















            • 4





              I wonder why is this so. There are many C++ libraries that work precompiled inside /lib.

              – Slazer
              Nov 28 '12 at 19:39












            • 4





              I wonder why is this so. There are many C++ libraries that work precompiled inside /lib.

              – Slazer
              Nov 28 '12 at 19:39







            4




            4





            I wonder why is this so. There are many C++ libraries that work precompiled inside /lib.

            – Slazer
            Nov 28 '12 at 19:39





            I wonder why is this so. There are many C++ libraries that work precompiled inside /lib.

            – Slazer
            Nov 28 '12 at 19:39











            0



















            In total, i use two installation methods, but in the second method you need to create the 'CMakeLists.txt' (where the data of your project will be indicated, subdirectory) file yourself and put it in the '/root/my_build directory'. I needed to uninstall the old version of 'cmake' and install a new one. I tried to install on Ubuntu 18.04.3 LTS 'gmock' on the root and everything related to its installation.



            method 1:



            # apt search gmock



            # apt-get installyour version gmock



            method 2:



            # apt install unzip



            # wget https://github.com/cfmobile/gmock/archive/master.zip



            # unzip master.zip -d /$GMOCK_ROOT



            # cd $GMOCK_ROOT



            # mkdir my_build



            # cd my_build



            # cmake ..



            # cd .. (exit from my_build, if 'CMakeLists.txt' not found, you must create it
            yourself).



            find and delete the old version cmake:



            # apt list --installed | grep cmake



            # apt-get remove cmake



            # cmake --version



            # reboot



            install new version cmake:



            # wget https://github.com/Kitware/CMake/releases/download/v3.15.3/cmake-3.15.3.tar.gz



            # tar -zxvf cmake-3.15.3.tar.gz



            # cd cmake-3.15.3



            # ./configure



            # make



            # make install



            # reboot



            again go back to /root/my_build:



            # cd my_build



            # cmake ..



            # make --jobs 4



            # cd $GMOCK_HOME/gtest



            # mkdir



            # cd my_build



            # cmake ..



            # make --jobs 4






            share|improve this answer
































              0



















              In total, i use two installation methods, but in the second method you need to create the 'CMakeLists.txt' (where the data of your project will be indicated, subdirectory) file yourself and put it in the '/root/my_build directory'. I needed to uninstall the old version of 'cmake' and install a new one. I tried to install on Ubuntu 18.04.3 LTS 'gmock' on the root and everything related to its installation.



              method 1:



              # apt search gmock



              # apt-get installyour version gmock



              method 2:



              # apt install unzip



              # wget https://github.com/cfmobile/gmock/archive/master.zip



              # unzip master.zip -d /$GMOCK_ROOT



              # cd $GMOCK_ROOT



              # mkdir my_build



              # cd my_build



              # cmake ..



              # cd .. (exit from my_build, if 'CMakeLists.txt' not found, you must create it
              yourself).



              find and delete the old version cmake:



              # apt list --installed | grep cmake



              # apt-get remove cmake



              # cmake --version



              # reboot



              install new version cmake:



              # wget https://github.com/Kitware/CMake/releases/download/v3.15.3/cmake-3.15.3.tar.gz



              # tar -zxvf cmake-3.15.3.tar.gz



              # cd cmake-3.15.3



              # ./configure



              # make



              # make install



              # reboot



              again go back to /root/my_build:



              # cd my_build



              # cmake ..



              # make --jobs 4



              # cd $GMOCK_HOME/gtest



              # mkdir



              # cd my_build



              # cmake ..



              # make --jobs 4






              share|improve this answer






























                0















                0











                0









                In total, i use two installation methods, but in the second method you need to create the 'CMakeLists.txt' (where the data of your project will be indicated, subdirectory) file yourself and put it in the '/root/my_build directory'. I needed to uninstall the old version of 'cmake' and install a new one. I tried to install on Ubuntu 18.04.3 LTS 'gmock' on the root and everything related to its installation.



                method 1:



                # apt search gmock



                # apt-get installyour version gmock



                method 2:



                # apt install unzip



                # wget https://github.com/cfmobile/gmock/archive/master.zip



                # unzip master.zip -d /$GMOCK_ROOT



                # cd $GMOCK_ROOT



                # mkdir my_build



                # cd my_build



                # cmake ..



                # cd .. (exit from my_build, if 'CMakeLists.txt' not found, you must create it
                yourself).



                find and delete the old version cmake:



                # apt list --installed | grep cmake



                # apt-get remove cmake



                # cmake --version



                # reboot



                install new version cmake:



                # wget https://github.com/Kitware/CMake/releases/download/v3.15.3/cmake-3.15.3.tar.gz



                # tar -zxvf cmake-3.15.3.tar.gz



                # cd cmake-3.15.3



                # ./configure



                # make



                # make install



                # reboot



                again go back to /root/my_build:



                # cd my_build



                # cmake ..



                # make --jobs 4



                # cd $GMOCK_HOME/gtest



                # mkdir



                # cd my_build



                # cmake ..



                # make --jobs 4






                share|improve this answer
















                In total, i use two installation methods, but in the second method you need to create the 'CMakeLists.txt' (where the data of your project will be indicated, subdirectory) file yourself and put it in the '/root/my_build directory'. I needed to uninstall the old version of 'cmake' and install a new one. I tried to install on Ubuntu 18.04.3 LTS 'gmock' on the root and everything related to its installation.



                method 1:



                # apt search gmock



                # apt-get installyour version gmock



                method 2:



                # apt install unzip



                # wget https://github.com/cfmobile/gmock/archive/master.zip



                # unzip master.zip -d /$GMOCK_ROOT



                # cd $GMOCK_ROOT



                # mkdir my_build



                # cd my_build



                # cmake ..



                # cd .. (exit from my_build, if 'CMakeLists.txt' not found, you must create it
                yourself).



                find and delete the old version cmake:



                # apt list --installed | grep cmake



                # apt-get remove cmake



                # cmake --version



                # reboot



                install new version cmake:



                # wget https://github.com/Kitware/CMake/releases/download/v3.15.3/cmake-3.15.3.tar.gz



                # tar -zxvf cmake-3.15.3.tar.gz



                # cd cmake-3.15.3



                # ./configure



                # make



                # make install



                # reboot



                again go back to /root/my_build:



                # cd my_build



                # cmake ..



                # make --jobs 4



                # cd $GMOCK_HOME/gtest



                # mkdir



                # cd my_build



                # cmake ..



                # make --jobs 4







                share|improve this answer















                share|improve this answer




                share|improve this answer








                edited Sep 15 at 10:01

























                answered Sep 14 at 21:27









                Fithe_XankiFithe_Xanki

                12 bronze badges




                12 bronze badges































                    draft saved

                    draft discarded















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f219516%2fhowto-install-google-mock-on-ubuntu-12-10%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown









                    Popular posts from this blog

                    Tamil (spriik) Luke uk diar | Nawigatjuun

                    Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                    Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?