1

I am working on a c++ project using mosquitto library on github. I am trying to compile the C++ on a windows computer on the command line; however I keep getting error

Fatal error: mosquitto.h: no such file or directory include "mosquitto.h"

I have installed the mosquitto library in the windows system, underneath:

C:\Program Files\mosquitto\devel\mosquitto.h

Is there something else that I have to do as well in order to compile the cpp from the command line. How do I tell g++ the whereabout of the mosquitto.h file. So I can compile on the command line

Thank for your help I am new to C++.

codespider
  • 51
  • 1
  • 2
  • 7

1 Answers1

0

I managed to solve this question, I had o copy the mosquitto.h into

C:\cygwin64\usr\include

Then when I type g++ nameOfFile it compiled

codespider
  • 51
  • 1
  • 2
  • 7
  • 1
    You most likely just needed to update the path that your compiler looks for headers. I would not recommend putting files into your system headers to get around adding an additional path. – drescherjm Mar 21 '19 at 14:38
  • @drescherjm how do I update the path that the compile uses to looks for the headers? – codespider Mar 21 '19 at 14:47
  • That depends on how your are compiling and what compiler you are using. If you are using gcc from the shell: https://stackoverflow.com/questions/973146/how-to-include-header-files-in-gcc-search-path – drescherjm Mar 21 '19 at 14:49