Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building on Windows #33

Closed
dzhigit1 opened this issue Mar 23, 2021 · 4 comments
Closed

Building on Windows #33

dzhigit1 opened this issue Mar 23, 2021 · 4 comments

Comments

@dzhigit1
Copy link

dzhigit1 commented Mar 23, 2021

I think I almost figured out build on Windows but I have this issue:

error: TIME_UTC 'undeclared'

src/util/time.h:11:23 is:

timespec_get(&ts, TIME_UTC);

I guess Windows does not implement TIME_UTC thing. I am not C programmer unfortunately. Is there workaround?

@jdah
Copy link
Owner

jdah commented Mar 23, 2021

I don't have a windows machine to test, but it actually doesn't matter what that second parameter is. If you can find a legal value it should work fine (it's only used for difference so the locality of the time doesn't matter).

@dzhigit1
Copy link
Author

I changed it to 1000000. Works in GNU/Linux and gets past that error in Windows. However now on Windows I think I am running in to #23 . No 2 implementations of that qsort_r or qsort_s are the same...

@jdah
Copy link
Owner

jdah commented Apr 24, 2021

Merging with #23.

@jdah jdah closed this as completed Apr 24, 2021
@dzhigit1
Copy link
Author

dzhigit1 commented Dec 3, 2021

I don't think the issue is #23 but they're related. After trying in GCC I tried in clang, and it gave the same error.

clang -o src/world/world.o -c src/world/world.c -std=c11 -O3 -g -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wno-pointer-arith -Wno-newline-eof -Wno-unused-parameter -Wno-gnu-statement-expression -Wno-gnu-compound-literal-initializer -Wno-gnu-zero-variadic-macro-arguments -Ilib/cglm/include -Ilib/glad/include -Ilib/glfw/include -Ilib/stb -Ilib/noise -fbracket-depth=1024
In file included from src/world/world.c:4:
src/world/../util/sort.h:33:25: error: variable has incomplete type 'struct _sort_r_data'
    struct _sort_r_data tmp = {arg, cmp};
                        ^
src/world/../util/sort.h:33:12: note: forward declaration of 'struct _sort_r_data'
    struct _sort_r_data tmp = {arg, cmp};
           ^
src/world/../util/sort.h:34:33: error: use of undeclared identifier 'sort_r_arg_swap'; did you mean '_sort_r_arg_swap'?
    qsort_s(*base, nel, width, &sort_r_arg_swap, &tmp);
                                ^~~~~~~~~~~~~~~
                                _sort_r_arg_swap
src/world/../util/sort.h:13:12: note: '_sort_r_arg_swap' declared here
static int _sort_r_arg_swap(void *s, const void *aa, const void *bb) {
           ^
src/world/world.c:235:11: warning: implicit declaration of function 'timespec_get' is invalid in C99 [-Wimplicit-function-declaration]
    SRAND(NOW());
          ^
src/world/../gfx/../util/time.h:11:5: note: expanded from macro 'NOW'
    timespec_get(&ts, 100);\
    ^
1 warning and 2 errors generated.
mingw32-make: *** [Makefile:46: src/world/world.o] Error 1

I don't know C but sort.h seems to be buggy. I fixed sort.h:34:33 by changing &sort_r_arg_swap to &_sort_r_arg_swap but don't know if it's the right fix, and it's failing because of sort.h:33:25. Can this issue be reopened?

#47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants