swisspol/GCDWebServer

Uncomplete instructions in the Readme

Closed this issue · 3 comments

Hello,

I am trying to integrate GCDWebServer in a Swift application. I am reaching you here instead of stackoverflow or other forums in the hope that the Readme could be clarified for all potential users.

I applied the Readme instructions in this initially new repository:

  • create a new Swift project
  • add GCDWebServer submodule (latest version - 3.5.4)
  • create an objective-c file and accept autocreation of the bridge header
  • add file the GCDWebServer subdirectory
  • link with libz (from OSX)
  • add libxml2 to search path
  • copy/paste example bridge header and code from https://github.com/swisspol/GCDWebServer
  • try to build/run app

Unfortunately, the following errors are displayed:

/Users/camptocamp/code/gcdwebserver_helloword/gcdwebserver_helloword/gcdwebserver_helloword-Bridging-Header.h:7:9: 'GCDWebServer/GCDWebServer.h' file not found
unknown>:0: error: failed to emit precompiled header '/Users/camptocamp/Library/Developer/Xcode/DerivedData/gcdwebserver_helloword-awmbxrpwvjrbknhlczpghulgwqeq/Build/Intermediates.noindex/PrecompiledHeaders/gcdwebserver_helloword-Bridging-Header-swift_WCG2H2I4C6OF-clang_232AJ4LZ1EGPJ.pch' for bridging header '/Users/camptocamp/code/gcdwebserver_helloword/gcdwebserver_helloword/gcdwebserver_helloword-Bridging-Header.h'

I also tried the alternate cocoapod method, but it was also failing (differently).

Do someone have the full instructions? I can then help update the Readme, if needed.

X-43A commented

Hello,
first of all I want to say that I'm not a professional and this might not be the best solution but it works, so here it goes:

- You should import GCDWebServer as a group not as a folder reference (when the folder icon is blue it means it is a folder reference when it is yellow it means it is a group)
Difference between folder and group

- In your bridging header the include should be quoted instead of angled and you should write the name of file (now that you're using groups instead of folders)
Difference between angled and quoted includes

I attached the working project in this comment. Hope this helps ;)
gcdwebserver_helloword-master.zip

Thank you very much @X-43A, it is a great help indeed.

I noticed in you zip that the third step necessary to make the project build is to remove the "import GCDWebServer" from the swift file.

I can update the readme with these working instructions.
Or is there a better method?

X-43A commented

Ah yes, I completely forgot that step.
I don't know if there's a better method. Cocopods is the simplest one but I had some bugs later on so I had to import GCDWebServer manually like you did.