Paho MQTT throws undefined reference error during compile





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I have a problem using Paho MQTT client in C.



I downloaded the pre built binaries for my system (Windows 10 64) from their projects page. I unpacked the zip file to a folder in the documents folder, where I also created a .c file with the example at the bottom of the Paho product page. My editor is atom and my compiler is gcc.



When I tried to compile it in Atom, I got this error:



undefined reference to MQTTClient_create' 


So I went searching and found plenty of topics, but I still couldn't figure out, how to resolve this issue. From this stackoverflow topic I gather that it's a linker problem and that I need to link the files during compile, so here's what I tried:



gcc MQTT.c -L "C:UsersPeteDocumentsMQTT on CExamplesPaholib" -l paho-mqtt3c


Which still gives me the same undefined reference error. When I try to link to the dll of the same name, the compiler does not find the file.



Can anyone point me in the right direction, please?

Any help is appreciated!










share|improve this question













migrated from superuser.com Jan 4 at 10:31


This question came from our site for computer enthusiasts and power users.

























    1















    I have a problem using Paho MQTT client in C.



    I downloaded the pre built binaries for my system (Windows 10 64) from their projects page. I unpacked the zip file to a folder in the documents folder, where I also created a .c file with the example at the bottom of the Paho product page. My editor is atom and my compiler is gcc.



    When I tried to compile it in Atom, I got this error:



    undefined reference to MQTTClient_create' 


    So I went searching and found plenty of topics, but I still couldn't figure out, how to resolve this issue. From this stackoverflow topic I gather that it's a linker problem and that I need to link the files during compile, so here's what I tried:



    gcc MQTT.c -L "C:UsersPeteDocumentsMQTT on CExamplesPaholib" -l paho-mqtt3c


    Which still gives me the same undefined reference error. When I try to link to the dll of the same name, the compiler does not find the file.



    Can anyone point me in the right direction, please?

    Any help is appreciated!










    share|improve this question













    migrated from superuser.com Jan 4 at 10:31


    This question came from our site for computer enthusiasts and power users.





















      1












      1








      1








      I have a problem using Paho MQTT client in C.



      I downloaded the pre built binaries for my system (Windows 10 64) from their projects page. I unpacked the zip file to a folder in the documents folder, where I also created a .c file with the example at the bottom of the Paho product page. My editor is atom and my compiler is gcc.



      When I tried to compile it in Atom, I got this error:



      undefined reference to MQTTClient_create' 


      So I went searching and found plenty of topics, but I still couldn't figure out, how to resolve this issue. From this stackoverflow topic I gather that it's a linker problem and that I need to link the files during compile, so here's what I tried:



      gcc MQTT.c -L "C:UsersPeteDocumentsMQTT on CExamplesPaholib" -l paho-mqtt3c


      Which still gives me the same undefined reference error. When I try to link to the dll of the same name, the compiler does not find the file.



      Can anyone point me in the right direction, please?

      Any help is appreciated!










      share|improve this question














      I have a problem using Paho MQTT client in C.



      I downloaded the pre built binaries for my system (Windows 10 64) from their projects page. I unpacked the zip file to a folder in the documents folder, where I also created a .c file with the example at the bottom of the Paho product page. My editor is atom and my compiler is gcc.



      When I tried to compile it in Atom, I got this error:



      undefined reference to MQTTClient_create' 


      So I went searching and found plenty of topics, but I still couldn't figure out, how to resolve this issue. From this stackoverflow topic I gather that it's a linker problem and that I need to link the files during compile, so here's what I tried:



      gcc MQTT.c -L "C:UsersPeteDocumentsMQTT on CExamplesPaholib" -l paho-mqtt3c


      Which still gives me the same undefined reference error. When I try to link to the dll of the same name, the compiler does not find the file.



      Can anyone point me in the right direction, please?

      Any help is appreciated!







      windows-10 eclipse c mqtt






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 3 at 22:11









      PetePete

      309




      309




      migrated from superuser.com Jan 4 at 10:31


      This question came from our site for computer enthusiasts and power users.









      migrated from superuser.com Jan 4 at 10:31


      This question came from our site for computer enthusiasts and power users.


























          2 Answers
          2






          active

          oldest

          votes


















          0














          I'd be interested to know if you have registered the Paho MQTT dll in Windows?



          You should have paho-mqtt3c.dll as part of the download.



          I don't know if this will work for you, but I have the same issue (undefined reference to MQTTClient_create)...




          • Copy the dll file into c:/windows/system32


          • Run CMD Prompt as Administrator and type:



            regsvr32 i/ paho-mqtt3c.dll




          Worth a try.






          share|improve this answer
























          • I had not registered the dll in Windows. When I ran your command for paho-mqtt3c.dll I got: "The module "paho-mqtt3c.dll" was loaded but the entry-point DllRegisterServer was not found." It seems to work for the ...cs.dll, but the compiler gives me the same error as before.

            – Pete
            Jan 8 at 20:00



















          0














          The problem was that I was compiling the program with the 32-bit gcc compiler for the 64-bit library. Installing and using MinGW64 worked.






          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%2f54037176%2fpaho-mqtt-throws-undefined-reference-error-during-compile%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









            0














            I'd be interested to know if you have registered the Paho MQTT dll in Windows?



            You should have paho-mqtt3c.dll as part of the download.



            I don't know if this will work for you, but I have the same issue (undefined reference to MQTTClient_create)...




            • Copy the dll file into c:/windows/system32


            • Run CMD Prompt as Administrator and type:



              regsvr32 i/ paho-mqtt3c.dll




            Worth a try.






            share|improve this answer
























            • I had not registered the dll in Windows. When I ran your command for paho-mqtt3c.dll I got: "The module "paho-mqtt3c.dll" was loaded but the entry-point DllRegisterServer was not found." It seems to work for the ...cs.dll, but the compiler gives me the same error as before.

              – Pete
              Jan 8 at 20:00
















            0














            I'd be interested to know if you have registered the Paho MQTT dll in Windows?



            You should have paho-mqtt3c.dll as part of the download.



            I don't know if this will work for you, but I have the same issue (undefined reference to MQTTClient_create)...




            • Copy the dll file into c:/windows/system32


            • Run CMD Prompt as Administrator and type:



              regsvr32 i/ paho-mqtt3c.dll




            Worth a try.






            share|improve this answer
























            • I had not registered the dll in Windows. When I ran your command for paho-mqtt3c.dll I got: "The module "paho-mqtt3c.dll" was loaded but the entry-point DllRegisterServer was not found." It seems to work for the ...cs.dll, but the compiler gives me the same error as before.

              – Pete
              Jan 8 at 20:00














            0












            0








            0







            I'd be interested to know if you have registered the Paho MQTT dll in Windows?



            You should have paho-mqtt3c.dll as part of the download.



            I don't know if this will work for you, but I have the same issue (undefined reference to MQTTClient_create)...




            • Copy the dll file into c:/windows/system32


            • Run CMD Prompt as Administrator and type:



              regsvr32 i/ paho-mqtt3c.dll




            Worth a try.






            share|improve this answer













            I'd be interested to know if you have registered the Paho MQTT dll in Windows?



            You should have paho-mqtt3c.dll as part of the download.



            I don't know if this will work for you, but I have the same issue (undefined reference to MQTTClient_create)...




            • Copy the dll file into c:/windows/system32


            • Run CMD Prompt as Administrator and type:



              regsvr32 i/ paho-mqtt3c.dll




            Worth a try.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 8 at 18:24









            GeoRebGeoReb

            77




            77













            • I had not registered the dll in Windows. When I ran your command for paho-mqtt3c.dll I got: "The module "paho-mqtt3c.dll" was loaded but the entry-point DllRegisterServer was not found." It seems to work for the ...cs.dll, but the compiler gives me the same error as before.

              – Pete
              Jan 8 at 20:00



















            • I had not registered the dll in Windows. When I ran your command for paho-mqtt3c.dll I got: "The module "paho-mqtt3c.dll" was loaded but the entry-point DllRegisterServer was not found." It seems to work for the ...cs.dll, but the compiler gives me the same error as before.

              – Pete
              Jan 8 at 20:00

















            I had not registered the dll in Windows. When I ran your command for paho-mqtt3c.dll I got: "The module "paho-mqtt3c.dll" was loaded but the entry-point DllRegisterServer was not found." It seems to work for the ...cs.dll, but the compiler gives me the same error as before.

            – Pete
            Jan 8 at 20:00





            I had not registered the dll in Windows. When I ran your command for paho-mqtt3c.dll I got: "The module "paho-mqtt3c.dll" was loaded but the entry-point DllRegisterServer was not found." It seems to work for the ...cs.dll, but the compiler gives me the same error as before.

            – Pete
            Jan 8 at 20:00













            0














            The problem was that I was compiling the program with the 32-bit gcc compiler for the 64-bit library. Installing and using MinGW64 worked.






            share|improve this answer




























              0














              The problem was that I was compiling the program with the 32-bit gcc compiler for the 64-bit library. Installing and using MinGW64 worked.






              share|improve this answer


























                0












                0








                0







                The problem was that I was compiling the program with the 32-bit gcc compiler for the 64-bit library. Installing and using MinGW64 worked.






                share|improve this answer













                The problem was that I was compiling the program with the 32-bit gcc compiler for the 64-bit library. Installing and using MinGW64 worked.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 11 at 0:03









                PetePete

                309




                309






























                    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.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54037176%2fpaho-mqtt-throws-undefined-reference-error-during-compile%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

                    Mossoró

                    Error while reading .h5 file using the rhdf5 package in R

                    Pushsharp Apns notification error: 'InvalidToken'