A lot of warnings when compiling date library












-1














The date library is very useful but you can see a lot of warnings after compiling a simple example that uses date library.
for example:



#include "date.h"
int main() {
using namespace date;
std::cout << weekday{July/4/2001} << 'n';
}


compiled with:



g++ -c -Waggregate-return main.cpp

warning: function call has aggregate value [-Waggregate-return]...









share|improve this question




















  • 1




    Can you show us the warnings?
    – mch
    Nov 20 '18 at 9:00










  • What is your question?
    – VTT
    Nov 20 '18 at 9:00










  • yes, compile without errors but with a lot of warnings.
    – sadig
    Nov 20 '18 at 9:01






  • 1




    stackoverflow.com/questions/14016993/…
    – The Unknown
    Nov 20 '18 at 9:09






  • 3




    and what is the reason you compile with -Waggregate-return? it is a pretty obscure (and useless) flag that triggers warnings for a valid C++ code.
    – bolov
    Nov 20 '18 at 10:10


















-1














The date library is very useful but you can see a lot of warnings after compiling a simple example that uses date library.
for example:



#include "date.h"
int main() {
using namespace date;
std::cout << weekday{July/4/2001} << 'n';
}


compiled with:



g++ -c -Waggregate-return main.cpp

warning: function call has aggregate value [-Waggregate-return]...









share|improve this question




















  • 1




    Can you show us the warnings?
    – mch
    Nov 20 '18 at 9:00










  • What is your question?
    – VTT
    Nov 20 '18 at 9:00










  • yes, compile without errors but with a lot of warnings.
    – sadig
    Nov 20 '18 at 9:01






  • 1




    stackoverflow.com/questions/14016993/…
    – The Unknown
    Nov 20 '18 at 9:09






  • 3




    and what is the reason you compile with -Waggregate-return? it is a pretty obscure (and useless) flag that triggers warnings for a valid C++ code.
    – bolov
    Nov 20 '18 at 10:10
















-1












-1








-1







The date library is very useful but you can see a lot of warnings after compiling a simple example that uses date library.
for example:



#include "date.h"
int main() {
using namespace date;
std::cout << weekday{July/4/2001} << 'n';
}


compiled with:



g++ -c -Waggregate-return main.cpp

warning: function call has aggregate value [-Waggregate-return]...









share|improve this question















The date library is very useful but you can see a lot of warnings after compiling a simple example that uses date library.
for example:



#include "date.h"
int main() {
using namespace date;
std::cout << weekday{July/4/2001} << 'n';
}


compiled with:



g++ -c -Waggregate-return main.cpp

warning: function call has aggregate value [-Waggregate-return]...






c++ date






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 10:56









M.K

359219




359219










asked Nov 20 '18 at 8:56









sadig

265




265








  • 1




    Can you show us the warnings?
    – mch
    Nov 20 '18 at 9:00










  • What is your question?
    – VTT
    Nov 20 '18 at 9:00










  • yes, compile without errors but with a lot of warnings.
    – sadig
    Nov 20 '18 at 9:01






  • 1




    stackoverflow.com/questions/14016993/…
    – The Unknown
    Nov 20 '18 at 9:09






  • 3




    and what is the reason you compile with -Waggregate-return? it is a pretty obscure (and useless) flag that triggers warnings for a valid C++ code.
    – bolov
    Nov 20 '18 at 10:10
















  • 1




    Can you show us the warnings?
    – mch
    Nov 20 '18 at 9:00










  • What is your question?
    – VTT
    Nov 20 '18 at 9:00










  • yes, compile without errors but with a lot of warnings.
    – sadig
    Nov 20 '18 at 9:01






  • 1




    stackoverflow.com/questions/14016993/…
    – The Unknown
    Nov 20 '18 at 9:09






  • 3




    and what is the reason you compile with -Waggregate-return? it is a pretty obscure (and useless) flag that triggers warnings for a valid C++ code.
    – bolov
    Nov 20 '18 at 10:10










1




1




Can you show us the warnings?
– mch
Nov 20 '18 at 9:00




Can you show us the warnings?
– mch
Nov 20 '18 at 9:00












What is your question?
– VTT
Nov 20 '18 at 9:00




What is your question?
– VTT
Nov 20 '18 at 9:00












yes, compile without errors but with a lot of warnings.
– sadig
Nov 20 '18 at 9:01




yes, compile without errors but with a lot of warnings.
– sadig
Nov 20 '18 at 9:01




1




1




stackoverflow.com/questions/14016993/…
– The Unknown
Nov 20 '18 at 9:09




stackoverflow.com/questions/14016993/…
– The Unknown
Nov 20 '18 at 9:09




3




3




and what is the reason you compile with -Waggregate-return? it is a pretty obscure (and useless) flag that triggers warnings for a valid C++ code.
– bolov
Nov 20 '18 at 10:10






and what is the reason you compile with -Waggregate-return? it is a pretty obscure (and useless) flag that triggers warnings for a valid C++ code.
– bolov
Nov 20 '18 at 10:10














2 Answers
2






active

oldest

votes


















1














Depending on the version of your compiler, C++11 (or later) mode might not be active, so try adding -std=gnu++0x at least. Also you code needs #include <iostream> added.






share|improve this answer





























    1














    To fix these warnings you should remove the flag -Waggregate-return from your compile string. This flag causes warnings for valid code.



    Note that you also need #include <iostream>, and for older versions of g++ , -std=c++14 or a similar flag.






    share|improve this answer





















      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389377%2fa-lot-of-warnings-when-compiling-date-library%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      Depending on the version of your compiler, C++11 (or later) mode might not be active, so try adding -std=gnu++0x at least. Also you code needs #include <iostream> added.






      share|improve this answer


























        1














        Depending on the version of your compiler, C++11 (or later) mode might not be active, so try adding -std=gnu++0x at least. Also you code needs #include <iostream> added.






        share|improve this answer
























          1












          1








          1






          Depending on the version of your compiler, C++11 (or later) mode might not be active, so try adding -std=gnu++0x at least. Also you code needs #include <iostream> added.






          share|improve this answer












          Depending on the version of your compiler, C++11 (or later) mode might not be active, so try adding -std=gnu++0x at least. Also you code needs #include <iostream> added.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 '18 at 10:04









          Bo R

          616110




          616110

























              1














              To fix these warnings you should remove the flag -Waggregate-return from your compile string. This flag causes warnings for valid code.



              Note that you also need #include <iostream>, and for older versions of g++ , -std=c++14 or a similar flag.






              share|improve this answer


























                1














                To fix these warnings you should remove the flag -Waggregate-return from your compile string. This flag causes warnings for valid code.



                Note that you also need #include <iostream>, and for older versions of g++ , -std=c++14 or a similar flag.






                share|improve this answer
























                  1












                  1








                  1






                  To fix these warnings you should remove the flag -Waggregate-return from your compile string. This flag causes warnings for valid code.



                  Note that you also need #include <iostream>, and for older versions of g++ , -std=c++14 or a similar flag.






                  share|improve this answer












                  To fix these warnings you should remove the flag -Waggregate-return from your compile string. This flag causes warnings for valid code.



                  Note that you also need #include <iostream>, and for older versions of g++ , -std=c++14 or a similar flag.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 20 '18 at 10:19









                  M.M

                  104k11113234




                  104k11113234






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389377%2fa-lot-of-warnings-when-compiling-date-library%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                      Alcedinidae

                      Origin of the phrase “under your belt”?