EPIJudge icon indicating copy to clipboard operation
EPIJudge copied to clipboard

Errors when using "make" command or the manual command line options to compile c++ solutions. Visual Studio can compile them just fine

Open prepperoni opened this issue 6 years ago • 9 comments

Here are the errors I get for "make search_maze" for example:

mkdir -p cpp_build g++ -std=c++17 -pthread -Werror -g -O0 -o cpp_build/search_maze search_maze.cc In file included from test_framework/test_utils.h:19:0, from test_framework/generic_test_handler.h:11, from test_framework/generic_test.h:12, from search_maze.cc:6: test_framework/platform.h: In function ‘int platform::StdOutFd()’: test_framework/platform.h:34:10: error: ‘_fileno’ was not declared in this scope return _fileno(stdout); ^~~~~~~ test_framework/platform.h:34:10: note: suggested alternative: ‘__sfileno’ return _fileno(stdout); ^~~~~~~ __sfileno test_framework/platform.h: In function ‘int platform::IsATty(int)’: test_framework/platform.h:42:10: error: ‘_isatty’ was not declared in this scope return _isatty(fd); ^~~~~~~ test_framework/platform.h: In function ‘bool platform::IsDir(const char*)’: test_framework/platform.h:62:16: error: variable ‘platform::IsDir(const char*)::_stat buf’ has initializer but incomplete type struct _stat buf {}; ^~~ test_framework/platform.h:63:19: error: invalid use of incomplete type ‘struct platform::IsDir(const char*)::_stat’ _stat(path, &buf); ^ test_framework/platform.h:62:10: note: forward declaration of ‘struct platform::IsDir(const char*)::_stat’ struct stat buf {}; ^~~~~ In file included from test_framework/test_failure.h:7:0, from test_framework/test_utils.h:20, from test_framework/generic_test_handler.h:11, from test_framework/generic_test.h:12, from search_maze.cc:6: test_framework/any.h: At global scope: test_framework/any.h:67:7: error: ‘Any’ has a field ‘Any::ptr’ whose type uses the anonymous namespace [-Werror=subobject-linkage] class Any { ^~~ cc1plus: all warnings being treated as errors make: *** [Makefile:1707: cpp_build/search_maze] Error 1

prepperoni avatar Jun 28 '18 16:06 prepperoni

@metopa @adnanaziz @tsunghsienlee

prepperoni avatar Jul 16 '18 01:07 prepperoni

@prepperoni Sorry for long wait. I'll take a look at the issue today. Any updates you want to share?

metopa avatar Jul 18 '18 16:07 metopa

@metopa No worries. I just cloned a fresh copy of this repo and tried to run "make zip_list" (randomly selected program) in the cpp solutions folder and the problem is still there

prepperoni avatar Jul 21 '18 03:07 prepperoni

@metopa @prepperoni Hi, I just cloned the master branch and everything seems working fine. I hope this issue can now be closed.

magician03 avatar Aug 12 '18 11:08 magician03

@prepperoni again, sorry for waiting. Which platform do you use? Is it MinGW, WSL or just pure Linux? As far as I can tell, our framework treats your system as Windows and tries to find Windows-specific symbols.

metopa avatar Aug 14 '18 03:08 metopa

@magician03 @metopa I just cloned the master branch just now and tried and still got the same error. I am using Cygwin on Windows 10.

prepperoni avatar Aug 16 '18 02:08 prepperoni

I also have the same problem on Win10 with Cygwin (Msys2).

dsp6622 avatar Aug 21 '18 15:08 dsp6622

@prepperoni @dsp6622 I don't have an access to Cygwin installation right now so I'd ask you to test fixes. In https://github.com/adnanaziz/EPIJudge/blob/master/epi_judge_cpp/test_framework/platform.h#L9 please remove || __CYGWIN__ part and try to compile now

metopa avatar Aug 28 '18 17:08 metopa

@metopa hey that actually fixed it for me. Thanks!

prepperoni avatar Aug 29 '18 04:08 prepperoni