using gtest with xcode - c++

I'm trying to set up a c++ unit testing library on my computer and figured that google's gtest would be a good fit.
I am currently running mountain lion with the most recent release of xcode.
I have been attempting to follow the instructions found here but am running into an intresting problem.
I am opening the gtest project, building it, and even though xcode tells me that the build was successful, I cant seem to find the framework anywhere. any help on this subject would be highly appreciated!
Thank you!

This worked for me:
Get the code from https://github.com/dmonopoly/gtest-cmake-example
Run the cmake GUI in the usual way (I used version 3.0.0). Hit "Configure", one of the prompts allows you to choose XCode generation. Hit configure again, Enable the "test" config option, hit configure again (and maybe even once again), then hit "Generate".
You should now be able to find the XCode project in the build directory that you specified. Open that project, and you will find the gtest source code, some demo test code, as well as a target for running the tests.

Related

Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update configuration settings

I just want to be able to compile/run my OpenGL C++ projects on my local machine.
Do I need "nRF Connect" if I'm only pursuing local projects?
I have VS Code installed running version 1.71.0 (user setup) on Windows_NT x64 10.0.22000
I am using the mingw64 compiler located in C:\msys64\mingw64\bin\g++.exe
My active kit is GCC 12.1.0 x86_64-w64-mingw64 that is displayed on the bottom faceted pane in the window
I have my "CMakeList.txt" generated with the corresponding "main.cpp" file using the "CMake: Quick start" tool
When I run the "CMake: Build" tool, I get the error "Unable to determine what CMake generator to use". Therefor my CMake "build" directory is never created in my $(workspace)
I have tried running the "CMake: Reset" tool and I don't think that is the problem right now. In my "settings.json" file at the bottom, I see "nrf-connect.toolchain.path: " setting is set to the value "PATH". I think that is one of the issues but don't know what value to change it too. Also my environment variable "Cmake: Configure Environment" located in settings->Extensions->CMake Tools is empty for my key/value pair, also don't know what to add to that as well. I've been combing the internet for weeks so I can articulate my problem to you guys which as much of it solved before I brought the issue here. I was able to compile/run my C++ projects on VS code with no issue prior to installing CMake but am trying to build projects with OpenGL. And from what I seen CMake is one of the options that is required when it comes to building OpenGL projects.
Don't send me some documentation as a solution because I tried it and that is why I'm here. It blows my mind that there isn't a step by step on how to integrate CMake with OpenGL in VS code. The tutorials I've seen, they skip a lot of crucial steps which is the dumbest thing I have ever seen and it leaves us pulling our hair out.
CMake: Configure Environment setting

"Could not determine which "make" command to run. Check the "make" step in the build configuration." Qt creator

I installed several times the qt creator but it never cost me as much as in my current PC; First I used the installer that always had on my Pendrive (that of Qt 5.8), told me that I could not download some repositories, I downloaded version 5.9 of the same installer, with the same result. After trying to install it several times and it did not load I went to another house where I managed to install it, although I had to be very aware of many errors coming out of missing libraries (while installing Qt 5.9). After this I had to download the sp1 for my win7 OS through "windows updates" to run the Qt creator, but later, when loading, creating or running a project, I would say in console (it does not matter if it is GUI) the following : "Could not determine which" make "command to run. Check the" make "step in the build configuration." I would very much appreciate your help to anyone who wants to advise me, because I have already had many problems with my computer, from losing everything (the previous hard drive had installed original win10) to a series of very annoying setbacks like this. I cannot post images, I have no more than 10 reputations.
edit 1: there are the images:
https://ibb.co/jcNp05
https://ibb.co/hMyU05
The problem is that the video you posted is for linux, but i thank you for your help. I need now more he
You have to set a valid compiler to build your project. As any compiler is not set, it is asking you to check the configuration.
For example in my PC, I get the following as compiler output:
11:13:33: Running steps for project ListViewExample...
11:13:33: Configuration unchanged, skipping qmake step.
11:13:33: Starting: "C:\Qt\Qt5.2.1\Tools\mingw48_32\bin\mingw32-make.exe"
C:/Qt/Qt5.2.1/Tools/mingw48_32/bin/mingw32-make -f Makefile.Debug
Here you can observe that C:/Qt/Qt5.2.1/Tools/mingw48_32/bin/mingw32-make is the make compiler which builds the application.
You can set the compiler path here:
Tools > Options > Build & Run > Kits. Select the kit displayed and select a
valid compiler.
How to add mingw compiler at the time of installation
Reference Video for similar issue
You can try this youtube video link. Hope this solves your problem.

Offline Qt Documentation

I am trying to compile QDoc following the steps given here https://wiki.qt.io/Building_Qt_Documentation. I am trying to compile QDoc without building the whole Qt project. I use mingw in windows 10. I run first configure in the main qt directory, then configure in qtbase, then make in qtbase. I am going then in the qtdeclarative directory and try to compile sub-qmldevtools as explained in the tutorial. Unfortunately the target is not recognized and no compiling occurs. Can anyone help ?
I have finally installed the QtDocs. For Qt 5.8 it worked almost as here: https://wiki.qt.io/Building_Qt_Documentation except for make qmake_all should be called immediately after configure is called in the root directory of the sources. Also i had to compile qtattributionsscanner from qttools for the make html_docs to work.
Alternatively to compiling the documentation one could also use zealdocs, that is one offline help tool for varios software APIs.

Debugging fails with QtCreator on OSX

I have OSX Yosemite 10.10.5, QtCreator 4.1.0, Qt 5.7.0 and Xcode 7.2.1.
If I write any native C++ program in QtCreator (console, gui - anything) I am unable to debug that program from QtCreator. Breakpoints get ignored, the program executes without pause and runs to completion no matter what I try.
I have tried the Xcode's LLDb, system GDB and Homebrew GDB as debuggers. the versions of GDB fail to start. Homebrew GDB has been codesigned.
This all used to (a few year back) just work beautifully and I am at a loss as to what might have changed.
Curiously, if I generate an exception inside the program - like accessing through a null pointer, the debugger shows me where this happens in just the way I would expect so, presumably, the debugger is running but simply treating me with complete disdain.
I know there are many versions of this question but none seem to address the problem adequately or offer workable solutions, or they apply to much older versions of the products.
Any suggestions?
This version of qtCreator (4.1.0) saw the return of the warning about having the build directory at the same level as the project directory. In Windows, this is done automatically. My mac installation does not get it right. (I may have messed a while back - cannot remember).
So - if the build directory is inside the project directory, debugging fails. Move the build directory up to the same level as the project directory and everything seems to work fine.
You can set the default build directory in the preferences/Build & Run dialogue. The path should start with ../
You will need to think about the folder structure before setting up the project unless you want build folders appearing in awkward places. So, a project folder structure like this is OK:
But one like this is not:
If this was already obvious to you, great. I have been messing with this for ages.
Many thanks to those who replied and anyone else who took the time to read the question. What helped e find it was the suggestion by #AlexanderVX that his setup was the same as mine but his worked. The only bit of my setup he could not see in the screenshots was the start of the build path. So that was the clue.

VSCode c++ configuring for vc toolchain

I'm trying to start a work in vscode , latest C++ plugin version supports ms debugger, so as I'm mostly working under windows it was a signal to try this.
c++ tools plugin from MS and cmake tools were installed.
my test project was however not built . the problem is clear , but I need an advice from experienced vscode users how to solve this right.
cmake doesn't see vc compiler.
(after using QtCreator) I expected that vscode could detect vc installation... however that's not so. ok, I have a two ways:
fill environment variables INCLUDE/LIB/PATH with a headers, libs and binaries
just run vcvarsall.bat x64
Second way is a simple and reliable. so final question is:
how to run .bat at the begining of vscode start?
(I don't mean write another bat/cmd, prepare the environment and run vscode inside the same script after that)
Although the question is fairly old, I'll try to give a useful answer, in case others stumble across, just like I did.
I believe what you are trying to achieve is not possible. Code inherits the environment it was started with. If you did not launch it from a developer command prompt, you will not be able build and debug. (Building might be possible if every task first starts the vcvarsall.bat, but that slows things down by a lot. Debugging I think will still not work.)
If you are willing to, you can check out vector-of-bools CMake Tools extension which does build automation as well as automatic MSVC detection. It builds using CMake (thus you need to write your build scripts using CMake), but it will take care of building just by pressing F7, like what most VS users are familiar with.