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

fatal error: variable has incomplete type 'void' #137

Open
MichaTausKamR opened this issue Aug 19, 2024 · 5 comments
Open

fatal error: variable has incomplete type 'void' #137

MichaTausKamR opened this issue Aug 19, 2024 · 5 comments

Comments

@MichaTausKamR
Copy link

Current Behaviour

When compiling, I get two errors:

azerothcore-wotlk/var/build/obj/modules/gen_scriptloader/static/ModulesLoader.cpp:30:6: fatal error: variable has incomplete type 'void'
void Add,.Scripts();
     ^
1 error generated.
gmake[2]: *** [modules/CMakeFiles/modules.dir/build.make:76: modules/CMakeFiles/modules.dir/gen_scriptloader/static/ModulesLoader.cpp.o] Error 1

and

/azerothcore-wotlk/modules/,./src/AnticheatMgr.cpp:35:23: fatal error: constexpr variable cannot have non-literal type 'const std::string' (aka 'const basic_string<char>')
constexpr std::string modulestring = "anticheat";

Expected Blizzlike Behaviour

Should compile fine

Source

No response

Steps to reproduce the problem

Use the playerbots-fork of Azerothcore
git pull the anticheat module
Compile

Extra Notes

No response

AC rev. hash/commit

Don't have one since it happens when I'm compiling

Operating system

Ubuntu 22.04

Custom changes or Modules

No response

@opbillbobaggins
Copy link

Also have 2 errors attempting to compile.

@Winfidonarleyan
Copy link
Member

Need use git clone

@opbillbobaggins
Copy link

still get
``/azerothcore/modules/mod-anticheat/src/AnticheatMgr.cpp:35:23: fatal error: constexpr variable 'modulestring' must be initialized by a constant expression
constexpr std::string modulestring = "anticheat";
^ ~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:356:10: note: assignment to member '_M_local_buf' of union with no active member is not allowed in a constant expression
__c = _CharT();
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/basic_string.tcc:229:4: note: in call to '&modulestring->_M_use_local_data()'
_M_use_local_data();
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:642:2: note: in call to '&modulestring->_M_construct(&"anticheat"[0], &"anticheat"[9], {{}})'
_M_construct(__s, __end, forward_iterator_tag());

/azerothcore/modules/mod-anticheat/src/AnticheatMgr.cpp:35:38: note: in call to 'basic_string(&"anticheat"[0], std::allocator())'
constexpr std::string modulestring = "anticheat";

@Winfidonarleyan
Copy link
Member

Winfidonarleyan commented Aug 20, 2024

std::string can't init via constexpr, yes, this is bad code

@cjl3230
Copy link

cjl3230 commented Aug 20, 2024

std::string 无法通过 constexpr 初始化,是的,这是错误的代码

constexpr const char* modulestring = "anticheat";

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

4 participants