Couldn't build google mock - c++

I tried to build google mock on Windows 7 by using MinGW. But I couldn't.
I downloaded google test and google mock from the web site below by clicking 'Download Zip' button.
[https://github.com/google/googletest][1]
I unzipped the file and execute the command on the command line.
> g++ -c -Iinclude -I. src/gmock-all.cc
But the error occurred.
> include/gmock/internal/gmock-port.h:53:45: fatal error: gtest/internal/gtest-linked_ptr.h: No such file or directory
How can I solve it?

You should first build googletest, and then googlemock. It comes bundled
with googlemock in subdirectory named "gtest". This is what you need to do:
g++ -isystem <path_to_gtest>/include -I<path_to_gtest> \
-isystem <path_to_gmock>/include -I<path_to_gmock> \
-pthread -c <path_to_gtest>/src/gtest-all.cc
g++ -isystem <path_to_gtest>/include -I<path_to_gtest> \
-isystem <path_to_gmock>/include -I<path_to_gmock> \
-pthread -c <path_to_gmock>/src/gmock-all.cc
This will definately work on Linux, but I cant be 100% sure for MinGW on
Win7. If it does not help, I suggest using Visual Studio Community Edition.
You already have a VS solution setup in <path_to_gmock>/msvc/2010. It
is a solution for VS2010 but opening it with a newer version will prompt you
to upgrade the toolset. Simply accept and build the "gmock" project in that
solution.o_gmock>/src/gmock-all.cc

Related

libswscale/swscale.h: No such file or directory

When installing Sumo-0.30.0 on Ubuntu 16.04, make resulted in the following error:
make[4]: Entering directory '/home/<path>/sumo-0.30.0/src/gui'
g++ -DHAVE_CONFIG_H -I. -I../../src -I/home/<path>/sumo-0.30.0/./src -I/usr/include/ffmpeg -I/usr/local/include -I/usr/include/fox-1.6 -I/usr/include/gdal -I/usr/local/include -I/usr/include -msse2 -mfpmath=sse -O2 -DNDEBUG -MT GUIViewTraffic.o -MD -MP -MF .deps/GUIViewTraffic.Tpo -c -o GUIViewTraffic.o GUIViewTraffic.cpp
In file included from GUIViewTraffic.cpp:36:0:
../../src/utils/gui/div/GUIVideoEncoder.h:58:32: fatal error: libswscale/swscale.h: No such file or directory
compilation terminated.
Makefile:449: recipe for target 'GUIViewTraffic.o' failed
Having installed all the prerequisite libraries as mentioned in Installing/Linux Build Libraries and verifying my ffmpeg version is the latest one, I proceeded with ./configure command from installation guide which was successful. The last lines of ./configure result shows that ffmpeg is enabled.
Optional features summary
-------------------------
Enabled: TRACI PROJ GDAL GUI ffmpeg
Disabled: Debug Profiling Coverage PIC UnitTests Python OSG
I could neither locate libswscale directory nor swscale.h even after going through similar post here.
According to another post here, someone mentions that on Ubuntu the problem is that ffmpeg package does not install swscale.h.
How do I fix this?
Install the libswscale-dev package. It provides /usr/include/*/libswscale/swscale.h.

Understanding LD under MSYS2

I'm trying to compile the simavr project from https://github.com/buserror/simavr on Windows 10 using MSYS2 and mingw-w64.
After editing the makefiles to enable the MSYS clauses (Which are commented out by default), and changing the order of 2 include files, I can get the project to compile. I do however encounter an error in the linking step.
The output is
C:/Programs/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lsimavr
Editing the makefile to print the ${LDFLAGS}, yield the following.
-L/lib -L/local/lib -L/c/Users/University/GitHub/simavr/simavr/../simavr/obj-i686-w64-mingw32 -lsimavr -lelf -lws2_32
Looking in the folder "obj-i686-w64-mingw32" mentioned in the build script, the file "libsimavr.a" is present. If I copy the file to the msys lib folder the linking step works fine.
The folder structure of the project is as follows:
simavr root (Where i run the makefile from, located in /c/Users/University/GitHub)
simavr
obj-i686-w64-mingw32
As far as I can tell, LD should be able to link properly without me copying the file manually. What am I missing here?
Edit:
The final command before the linker error.
cc -MMD -Werror -O2 -Wall -g -I/usr/local/include -DNO_COLOR -o obj-i686-w64-mingw32/run_avr.elf obj-i686-w64-mingw32/run_avr.o -L/lib -L/local/lib -L/c/Users/University/GitHub/simavr/simavr/../simavr/obj-i686-w64-mingw32 -lsimavr -lelf -lws2_32
Edit 2:
Cleaning the include paths of MSYS folders:
cc -MMD -Werror -O2 -Wall -g -DNO_COLOR -o obj-i686-w64-mingw32/run_avr.elf obj-i686-w64-mingw32/run_avr.o -L/c/Users/University/GitHub/simavr/simavr/../simavr/obj-i686-w64-mingw32 -lsimavr -lelf -lws2_32
C:/Programs/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lsimavr
Passing CC=gcc to make:
gcc -MMD -Werror -O2 -Wall -g -DNO_COLOR -o obj-i686-w64-mingw32/run_avr.elf obj-i686-w64-mingw32/run_avr.o -L/c/Users/University/GitHub/simavr/simavr/../simavr/obj-i686-w64-mingw32 -lsimavr -lelf -lws2_32
C:/Programs/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lsimavr
Edit 3:
Output of the find command:
$ find /c/Users/University/GitHub/simavr -name 'libsimavr.a'
/c/Users/University/GitHub/simavr/simavr/obj-i686-w64-mingw32/libsimavr.a
Note that previous entries have been made using the git bash prompt, not the one from msys2. However, running the same commands in the msys2 prompt or the mingw prompt from msys2 yields the same results.
Using mingw-w64 toolchain to build project you MUST remove from CFLAGS/CXXFLAGS/CPPFLAGS all paths with /usr, /local, /lib, /include as this paths can contain headers and libs from MSYS2 itself. Second, try pass "CC=gcc" to makefile.

make: g++: Command not found

I've checked similar posts and anyone solve my problem. I's very simple but I'm new with eclipse. I'm trying to make a simple example and I'm having this problem.
the make file is just this
all: hello.exe
clean:
rm Hello.o Hello.exe
hello.exe: hello.o
g++ -g -o hello.exe hello.o
hello.o:
g++ -c -g main.cpp
And I get this error "make: g++: Command not found"
Thanks for helping.
You need to install the development tools from GNU. I assume you're on windows, in which case you have two options: cygwin and mingw. The former includes g++ out of the box. I'm less familiar with mingw, but the C++ Standard library appears to, also, be available.
See these installation instructions, I'd recommend starting from step 1, if at all possible.
"sudo apt install g++" did the trick for on on Ubuntu 20 LTS.
Adding for RHEL users, installing development tools resolved the issue on rhel.
Command:
yum groupinstall 'Development Tools'

Setting up Netbeans to compile wxWidgets projects under Windows

I'm trying to set up my Netbeans IDE so that it is capable of compiling wxWidgets projects.
There is very similar question:
Setup wxWidget in Netbeans 6.1 C++ On MS Windows?
but the answer is not working for me. And the mentioned versions are a bit outdated.
I use the mingw package for compilation.
There is no problem compiling a small hello World App from the console using this command in mysys:
$ g++ hello.cpp `wx-config --libs` `wx-config --cxxflags` -o hello.exe
So here's what I tried in Netbeans:
Project properties:
C++ Compiler -> Additional Options: wx-config cxxflags (surrounded by backticks)
C++ Compiler -> Include directories: installation_Path/include
Linker -> Additional Options: wx-config --libs (surrounded by backticks)
The command lines Netbeans creates when I try to compile seem to be correct to me
g++.exe `wx-config --cxxflags` -c -g -I/D/lib/wxWidgets/include -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
This compiles without errors
g++.exe `wx-config --cxxflags` `wx-config --libs` -o dist/Debug/MinGW-Windows/wxwidgetstest build/Debug/MinGW-Windows/main.o -L/D/lib/wxWidgets/lib/gcc_lib
But during the linking process I get loads of errors...
Questions:
Does anybody have a working configuration for compiling wxWidgets Projects from within Netbeans and can help me out
Or does anybody see an error in the command lines could be the reason for the linking problems ?
Thank you very much!
I finally found the solution, and wrote a guide for anyone who might encounter the same problem in the future.
wxWidgets wiki: Compiling using Netbeans

eclipse compiling error

I just installed cygwin and eclipse on my win7 x64 machine, and after importing my code from svn, I get this weird error:
**** Build of configuration Default for project platform ****
make all
g++ -O2 -g -Wall -fmessage-length=0 -c -o platform.o platform.cpp
process_begin: CreateProcess(C:\cygwin\bin\g++.exe, g++ -O2 -g -Wall -fmessage-length=0 -c -o platform.o platform.cpp, ...) failed.
make (e=5): Access is denied.
make: *** [platform.o] Error 5
I've tried running eclipse as administrator, but that doesn't make any difference. Any clue how to fix this?
My windows PATH variable is C:\WinAVR-20100110\bin;C:\WinAVR-20100110\utils\bin;c:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jre6\bin\;C:\cygwin\bin
C:\cygwin\bin\g++.exe is a Cygwin symbolic link pointing to either g++-3.exe or g++-4.exe. Native Windows functions such as CreateProcess() don't understand Cygwin symbolic links though. Hence you need to configure Eclipse to execute g++-3.exe or g++-4.exe directly.