You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I’m a TA using googeltest in Github classroom. We have a setup with cmake that works on my Mac that will produce a makefile and runs google tests successfully. These projects are graded, and the Google tests “PASS” on github classroom when pushed.
The problem is things do not go as smoothly on Windows machines. While we can create a new solution on VS and compile and run these test files, it is not easily possible to push them to Github classroom to be autograded. We think having the same workflow as Github classroom autograder would be easiest to complete projects:
cmake.. && make && ./bin/test_executable
Students on Windows machines are able to run a project with the cmake workflow, but are unable to compile and run the googletests. When they try to run the project with cmake workflow on Windows, there are errors only when building the executables for the googletest files.
The commands we are using to build the project (in a build folder) are:
cmake -G “MinGW Makefiles” .. // this runs without errors
make
The make command produces a main.exe for the main executable that does not use the google test framework, but not for either of the 2 googletest files.
Things we have tried:
tutorials online for running gtest on windows but have received similar errors.
C:\Users\melhe\Desktop\rational_num\rational_num\build>cmake` -G "MinGW Makefiles" ..
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest
"C:\Program Files\CMake\bin\cmake.exe" -SC:\Users\melhe\Desktop\rational_num\rational_num\build\googletest -BC:\Users\melhe\Desktop\rational_num\rational_num\build\googletest --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_progress_start C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\CMakeFiles C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\\CMakeFiles\progress.marks
C:/MinGW/bin/mingw32-make.exe -s -f CMakeFiles\Makefile2 all
[ 11%] Performing update step for 'googletest'
[ 22%] No patch step for 'googletest'
[ 33%] No configure step for 'googletest'
[ 44%] No build step for 'googletest'
[ 55%] No install step for 'googletest'
[ 66%] No test step for 'googletest'
[ 77%] Completed 'googletest'
[100%] Built target googletest
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_progress_start C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\CMakeFiles 0
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/melhe/Desktop/rational_num/rational_num/build
C:\Users\melhe\Desktop\rational_num\rational_num\build>make
"C:\Program Files\CMake\bin\cmake.exe" -SC:\Users\melhe\Desktop\rational_num\rational_num -BC:\Users\melhe\Desktop\rational_num\rational_num\build --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_progress_start C:\Users\melhe\Desktop\rational_num\rational_num\build\CMakeFiles C:\Users\melhe\Desktop\rational_num\rational_num\build\\CMakeFiles\progress.marks
make -s -f CMakeFiles\Makefile2 all
[ 20%] Built target main
[ 24%] Building CXX object googletest/googletest-build/googlemock/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj
In file included from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:42:
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest.cc: In function 'testing::internal::TimeInMillis testing::internal::GetTimeInMillis()':
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest.cc:842:26: warning: 'int gettimeofday(timeval*, void*)' is deprecated [-Wdeprecated-declarations]
842 | gettimeofday(&now, NULL);
| ^
In file included from C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest.cc:103,
from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:42:
c:\mingw\include\sys\time.h:106:53: note: declared here
106 | int __cdecl __MINGW_NOTHROW __POSIX_2008_DEPRECATED gettimeofday
| ^~~~~~~~~~~~
In file included from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:42:
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest.cc:842:26: warning: 'int gettimeofday(timeval*, void*)' is deprecated [-Wdeprecated-declarations]
842 | gettimeofday(&now, NULL);
| ^
In file included from C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest.cc:103,
from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:42:
c:\mingw\include\sys\time.h:106:53: note: declared here
106 | int __cdecl __MINGW_NOTHROW __POSIX_2008_DEPRECATED gettimeofday
| ^~~~~~~~~~~~
In file included from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:45:
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest-port.cc: In constructor 'testing::internal::Mutex::Mutex()':
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest-port.cc:242:29: error: cannot convert 'CRITICAL_SECTION*' {aka '_CRITICAL_SECTION*'} to '_RTL_CRITICAL_SECTION*' in initialization
242 | critical_section_(new CRITICAL_SECTION) {
| ^~~~~~~~~~~~~~~~
| |
| CRITICAL_SECTION* {aka _CRITICAL_SECTION*}
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest-port.cc:243:31: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION' {aka '_CRITICAL_SECTION*'}
243 | ::InitializeCriticalSection(critical_section_);
| ^~~~~~~~~~~~~~~~~
| |
| _RTL_CRITICAL_SECTION*
In file included from c:\mingw\include\windows.h:44,
from C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest.cc:108,
from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:42:
c:\mingw\include\winbase.h:1981:51: note: initializing argument 1 of 'void InitializeCriticalSection(LPCRITICAL_SECTION)'
1981 | WINBASEAPI VOID WINAPI InitializeCriticalSection (LPCRITICAL_SECTION);
| ^~~~~~~~~~~~~~~~~~
In file included from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:45:
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest-port.cc: In destructor 'testing::internal::Mutex::~Mutex()':
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest-port.cc:253:29: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'PCRITICAL_SECTION' {aka '_CRITICAL_SECTION*'}
253 | ::DeleteCriticalSection(critical_section_);
| ^~~~~~~~~~~~~~~~~
| |
| _RTL_CRITICAL_SECTION*
In file included from c:\mingw\include\windows.h:44,
from C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest.cc:108,
from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:42:
c:\mingw\include\winbase.h:1500:47: note: initializing argument 1 of 'void DeleteCriticalSection(PCRITICAL_SECTION)'
1500 | WINBASEAPI void WINAPI DeleteCriticalSection (PCRITICAL_SECTION);
| ^~~~~~~~~~~~~~~~~
In file included from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:45:
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest-port.cc: In member function 'void testing::internal::Mutex::Lock()':
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest-port.cc:261:26: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION' {aka '_CRITICAL_SECTION*'}
261 | ::EnterCriticalSection(critical_section_);
| ^~~~~~~~~~~~~~~~~
| |
| _RTL_CRITICAL_SECTION*
In file included from c:\mingw\include\windows.h:44,
from C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest.cc:108,
from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:42:
c:\mingw\include\winbase.h:1531:46: note: initializing argument 1 of 'void EnterCriticalSection(LPCRITICAL_SECTION)'
1531 | WINBASEAPI void WINAPI EnterCriticalSection (LPCRITICAL_SECTION);
| ^~~~~~~~~~~~~~~~~~
In file included from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:45:
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest-port.cc: In member function 'void testing::internal::Mutex::Unlock()':
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest-port.cc:271:26: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION' {aka '_CRITICAL_SECTION*'}
271 | ::LeaveCriticalSection(critical_section_);
| ^~~~~~~~~~~~~~~~~
| |
| _RTL_CRITICAL_SECTION*
In file included from c:\mingw\include\windows.h:44,
from C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest.cc:108,
from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:42:
c:\mingw\include\winbase.h:2043:46: note: initializing argument 1 of 'void LeaveCriticalSection(LPCRITICAL_SECTION)'
2043 | WINBASEAPI void WINAPI LeaveCriticalSection (LPCRITICAL_SECTION);
| ^~~~~~~~~~~~~~~~~~
In file included from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:45:
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest-port.cc: In member function 'void testing::internal::Mutex::ThreadSafeLazyInit()':
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest-port.cc:292:29: error: cannot convert 'CRITICAL_SECTION*' {aka '_CRITICAL_SECTION*'} to '_RTL_CRITICAL_SECTION*' in assignment
292 | critical_section_ = new CRITICAL_SECTION;
| ^~~~~~~~~~~~~~~~~~~~
| |
| CRITICAL_SECTION* {aka _CRITICAL_SECTION*}
C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest-port.cc:293:37: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION' {aka '_CRITICAL_SECTION*'}
293 | ::InitializeCriticalSection(critical_section_);
| ^~~~~~~~~~~~~~~~~
| |
| _RTL_CRITICAL_SECTION*
In file included from c:\mingw\include\windows.h:44,
from C:/Users/melhe/Desktop/rational_num/rational_num/build/googletest/googletest-src/googletest/src/gtest.cc:108,
from C:\Users\melhe\Desktop\rational_num\rational_num\build\googletest\googletest-src\googletest\src\gtest-all.cc:42:
c:\mingw\include\winbase.h:1981:51: note: initializing argument 1 of 'void InitializeCriticalSection(LPCRITICAL_SECTION)'
1981 | WINBASEAPI VOID WINAPI InitializeCriticalSection (LPCRITICAL_SECTION);
| ^~~~~~~~~~~~~~~~~~
googletest\googletest-build\googlemock\gtest\CMakeFiles\gtest.dir\build.make:82: recipe for target 'googletest/googletest-build/googlemock/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj' failed
make[2]: *** [googletest/googletest-build/googlemock/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj] Error 1
CMakeFiles\Makefile2:295: recipe for target 'googletest/googletest-build/googlemock/gtest/CMakeFiles/gtest.dir/all' failed
make[1]: *** [googletest/googletest-build/googlemock/gtest/CMakeFiles/gtest.dir/all] Error 2
Makefile:148: recipe for target 'all' failed
make: *** [all] Error 2
The text was updated successfully, but these errors were encountered:
Thanks for your help! This project setup helped. I was actually able to get it running without Cygwin. I needed to install Windows 10 SDK through the Visual Studio installer, but it worked.
Hello,
I’m a TA using googeltest in Github classroom. We have a setup with cmake that works on my Mac that will produce a makefile and runs google tests successfully. These projects are graded, and the Google tests “PASS” on github classroom when pushed.
The problem is things do not go as smoothly on Windows machines. While we can create a new solution on VS and compile and run these test files, it is not easily possible to push them to Github classroom to be autograded. We think having the same workflow as Github classroom autograder would be easiest to complete projects:
Students on Windows machines are able to run a project with the cmake workflow, but are unable to compile and run the googletests. When they try to run the project with cmake workflow on Windows, there are errors only when building the executables for the googletest files.
The commands we are using to build the project (in a build folder) are:
The make command produces a main.exe for the main executable that does not use the google test framework, but not for either of the 2 googletest files.
Things we have tried:
Questions:
Here is the CMakeLists.txt:
Full error output:
The text was updated successfully, but these errors were encountered: