preprocessor doesn't work well

14 views
Skip to first unread message

Jason

unread,
Aug 12, 2020, 2:44:31 AM8/12/20
to ChicagoBoss


Hi guys, I'm using the CB to develop a web project, but the preprocessor doesn't work well.

same header file works well in another project, but not in the CB, it prints that there's a compile-error.


so I'm wondering why...



the header file
-author("Administrator").

-ifndef(GM_SERVER).
-define(GM_SERVER, true).

-record(gm_function, {
url = <<>> :: binary(),
name = <<>> :: binary(),
permission_id = 0 :: integer(),
group_tag = undefined :: atom()
}).

-record(gm_function_group, {
tag = undefined :: atom(),
name = <<>> :: binary()
}).

-define(ALL_PERMISSIONS, 0).
-record(permissions, {
server_list,
change_server_state,
check_server
}).

-define(GROUPS, [
#gm_function_group{ tag = server, name = <<"server"/utf8>> },
#gm_function_group{ tag = check_server, name = <<"chekc_server"/utf8>> }
]).

-define(CONSTRUCT_FUNCTION(Url, Name, PM, GroupTag),
#gm_function{ url = <<Url/utf8>>, name = <<Name/utf8>>, permission_id = PM, group_tag = GroupTag }
).

-define(FUNCTIONS, [
?CONSTRUCT_FUNCTION("/servers/list_view", "server_lists", #permissions.server_list, server),
?CONSTRUCT_FUNCTION("/servers/batch_change_server_state_view", "test", #permissions.change_server_state, server),
?CONSTRUCT_FUNCTION("/check_server/list_view", "test", #permissions.check_server, check_server)
]).

-endif.

Jason

unread,
Aug 12, 2020, 11:21:31 PM8/12/20
to ChicagoBoss
it seems that #record_name.field syntax couldn't appear in the CB project, there's not an error when I modified the #permiison.servers to a number.  

在 2020年8月12日星期三 UTC+8下午2:44:31,Jason写道:
Reply all
Reply to author
Forward
0 new messages