Why my code doesnt compile if weeks ago worked perfectly?











up vote
-3
down vote

favorite












I have this simple school project that plays music selected through a menu with the 'PlaySound'command. 3 weeks ago it worked perfectly but now that I want to upgrade it it just won't compile. It says something like




" [Linker error] C:UserspcAppDataLocalTempccAaBZrG.o:Proyecto.cpp:(.text+0x32d): undefined reference to `PlaySoundA@12 "




This is basically what it does, it just repeats for different genres/bands:
(Yes, I do have the music files inside the same folder as the program)



int PLAY1() {
switch(CAN1) {
case 1:
system("cls");
printf("nNow playing: AKFG - Solanin (4:28)");
PlaySound(TEXT("AKFG.wav"), NULL, SND_FILENAME | SND_ASYNC);
system ("pause");
system("cls");
ROC();
break;









share|improve this question




















  • 2




    You have this tagged as C, but you're compiling as C++. Perhaps you compiled the code with PlaySound as C, but Proyecto.cpp is looking for a C++ function?
    – nemequ
    Nov 11 at 5:31










  • If you've not changed the code since it worked three weeks ago, the problem is that something else changed — most probably the way that you compile the code, but possibly something was installed or uninstalled on the machine that is breaking the build process.
    – Jonathan Leffler
    Nov 11 at 5:43















up vote
-3
down vote

favorite












I have this simple school project that plays music selected through a menu with the 'PlaySound'command. 3 weeks ago it worked perfectly but now that I want to upgrade it it just won't compile. It says something like




" [Linker error] C:UserspcAppDataLocalTempccAaBZrG.o:Proyecto.cpp:(.text+0x32d): undefined reference to `PlaySoundA@12 "




This is basically what it does, it just repeats for different genres/bands:
(Yes, I do have the music files inside the same folder as the program)



int PLAY1() {
switch(CAN1) {
case 1:
system("cls");
printf("nNow playing: AKFG - Solanin (4:28)");
PlaySound(TEXT("AKFG.wav"), NULL, SND_FILENAME | SND_ASYNC);
system ("pause");
system("cls");
ROC();
break;









share|improve this question




















  • 2




    You have this tagged as C, but you're compiling as C++. Perhaps you compiled the code with PlaySound as C, but Proyecto.cpp is looking for a C++ function?
    – nemequ
    Nov 11 at 5:31










  • If you've not changed the code since it worked three weeks ago, the problem is that something else changed — most probably the way that you compile the code, but possibly something was installed or uninstalled on the machine that is breaking the build process.
    – Jonathan Leffler
    Nov 11 at 5:43













up vote
-3
down vote

favorite









up vote
-3
down vote

favorite











I have this simple school project that plays music selected through a menu with the 'PlaySound'command. 3 weeks ago it worked perfectly but now that I want to upgrade it it just won't compile. It says something like




" [Linker error] C:UserspcAppDataLocalTempccAaBZrG.o:Proyecto.cpp:(.text+0x32d): undefined reference to `PlaySoundA@12 "




This is basically what it does, it just repeats for different genres/bands:
(Yes, I do have the music files inside the same folder as the program)



int PLAY1() {
switch(CAN1) {
case 1:
system("cls");
printf("nNow playing: AKFG - Solanin (4:28)");
PlaySound(TEXT("AKFG.wav"), NULL, SND_FILENAME | SND_ASYNC);
system ("pause");
system("cls");
ROC();
break;









share|improve this question















I have this simple school project that plays music selected through a menu with the 'PlaySound'command. 3 weeks ago it worked perfectly but now that I want to upgrade it it just won't compile. It says something like




" [Linker error] C:UserspcAppDataLocalTempccAaBZrG.o:Proyecto.cpp:(.text+0x32d): undefined reference to `PlaySoundA@12 "




This is basically what it does, it just repeats for different genres/bands:
(Yes, I do have the music files inside the same folder as the program)



int PLAY1() {
switch(CAN1) {
case 1:
system("cls");
printf("nNow playing: AKFG - Solanin (4:28)");
PlaySound(TEXT("AKFG.wav"), NULL, SND_FILENAME | SND_ASYNC);
system ("pause");
system("cls");
ROC();
break;






c compiler-errors






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 5:38









chux

79.1k869145




79.1k869145










asked Nov 11 at 5:22









A. SuSa

12




12








  • 2




    You have this tagged as C, but you're compiling as C++. Perhaps you compiled the code with PlaySound as C, but Proyecto.cpp is looking for a C++ function?
    – nemequ
    Nov 11 at 5:31










  • If you've not changed the code since it worked three weeks ago, the problem is that something else changed — most probably the way that you compile the code, but possibly something was installed or uninstalled on the machine that is breaking the build process.
    – Jonathan Leffler
    Nov 11 at 5:43














  • 2




    You have this tagged as C, but you're compiling as C++. Perhaps you compiled the code with PlaySound as C, but Proyecto.cpp is looking for a C++ function?
    – nemequ
    Nov 11 at 5:31










  • If you've not changed the code since it worked three weeks ago, the problem is that something else changed — most probably the way that you compile the code, but possibly something was installed or uninstalled on the machine that is breaking the build process.
    – Jonathan Leffler
    Nov 11 at 5:43








2




2




You have this tagged as C, but you're compiling as C++. Perhaps you compiled the code with PlaySound as C, but Proyecto.cpp is looking for a C++ function?
– nemequ
Nov 11 at 5:31




You have this tagged as C, but you're compiling as C++. Perhaps you compiled the code with PlaySound as C, but Proyecto.cpp is looking for a C++ function?
– nemequ
Nov 11 at 5:31












If you've not changed the code since it worked three weeks ago, the problem is that something else changed — most probably the way that you compile the code, but possibly something was installed or uninstalled on the machine that is breaking the build process.
– Jonathan Leffler
Nov 11 at 5:43




If you've not changed the code since it worked three weeks ago, the problem is that something else changed — most probably the way that you compile the code, but possibly something was installed or uninstalled on the machine that is breaking the build process.
– Jonathan Leffler
Nov 11 at 5:43












1 Answer
1






active

oldest

votes

















up vote
2
down vote













I believe that the code is actually compiling fine, from your output. The issue is with the linker. What ever library you were including that contains the definition for the function PlaySound is likely missing from your build/include step?



Are you sure you are using the exact build/link steps as you were previously?






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',
    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%2f53246067%2fwhy-my-code-doesnt-compile-if-weeks-ago-worked-perfectly%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote













    I believe that the code is actually compiling fine, from your output. The issue is with the linker. What ever library you were including that contains the definition for the function PlaySound is likely missing from your build/include step?



    Are you sure you are using the exact build/link steps as you were previously?






    share|improve this answer

























      up vote
      2
      down vote













      I believe that the code is actually compiling fine, from your output. The issue is with the linker. What ever library you were including that contains the definition for the function PlaySound is likely missing from your build/include step?



      Are you sure you are using the exact build/link steps as you were previously?






      share|improve this answer























        up vote
        2
        down vote










        up vote
        2
        down vote









        I believe that the code is actually compiling fine, from your output. The issue is with the linker. What ever library you were including that contains the definition for the function PlaySound is likely missing from your build/include step?



        Are you sure you are using the exact build/link steps as you were previously?






        share|improve this answer












        I believe that the code is actually compiling fine, from your output. The issue is with the linker. What ever library you were including that contains the definition for the function PlaySound is likely missing from your build/include step?



        Are you sure you are using the exact build/link steps as you were previously?







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 5:25









        DMarczak

        1119




        1119






























            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%2f53246067%2fwhy-my-code-doesnt-compile-if-weeks-ago-worked-perfectly%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

            Florida Star v. B. J. F.

            Danny Elfman

            Lugert, Oklahoma