Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Compiling with gcc 15 gives error cannot declare ::main with a linkage specification [-Wpedantic] #1873

@papoteur-mga

Description

@papoteur-mga

To reproduce

Got colobot-0.2.2 from github archive
Build is done within a rpm spec using rpmbuild for Mageia Cauldron. Build instructions are:

%cmake -GNinja \
       -DCOLOBOT_INSTALL_LIB_DIR:PATH=%{_libdir}/%{name} \      
       -DCOLOBOT_INSTALL_DATA_DIR:PATH=%{_gamesdatadir}/%{name}
 %cmake_build

Error is

FAILED: src/CMakeFiles/colobot.dir/app/main.cpp.o 
/usr/bin/g++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_NO_CXX11_SCOPED_ENUMS -DBOOST_NO_SCOPED_ENUMS -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DHAVE_DEMANGLE -DNOEXCEPT=noexcept -DTEST_VIRTUAL="" -I/builddir/build/BUILD/colobot-0.2.2-build/colobot-colobot-gold-0.2.2-alpha/src -I/builddir/build/BUILD/colobot-0.2.2-build/colobot-colobot-gold-0.2.2-alpha/src/.. -I/builddir/build/BUILD/colobot-0.2.2-build/colobot-colobot-gold-0.2.2-alpha/build/src -I/builddir/build/BUILD/colobot-0.2.2-build/colobot-colobot-gold-0.2.2-alpha/src/CBot/.. -isystem /builddir/build/BUILD/colobot-0.2.2-build/colobot-colobot-gold-0.2.2-alpha/lib/localename -isystem /usr/include/SDL2 -isystem /usr/include/AL -O2 -g -pipe -Wformat -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -m64 -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection=full -Wall -Wold-style-cast -pedantic-errors -Wmissing-declarations -Wno-error=deprecated-declarations -Wsuggest-override -DNDEBUG -std=c++17 -MD -MT src/CMakeFiles/colobot.dir/app/main.cpp.o -MF src/CMakeFiles/colobot.dir/app/main.cpp.o.d -o src/CMakeFiles/colobot.dir/app/main.cpp.o -c /builddir/build/BUILD/colobot-0.2.2-build/colobot-colobot-gold-0.2.2-alpha/src/app/main.cpp
/builddir/build/BUILD/colobot-0.2.2-build/colobot-colobot-gold-0.2.2-alpha/src/app/main.cpp:108:5: error: cannot declare '::main' with a linkage specification [-Wpedantic]
 108 | int main(int argc, char *argv[])
     |     ^~~~

Console output (stdout and stderr)

No response

OS Info

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions