Set the \'Always Search User Parhs\' to \'Yes\' in Xcode, and Compile Failed


Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #891
    yincg
    Participant

      My App runs well before i set the Always Search User Paths to Yes.
      when i set it to Yes,it comes out a complied problem like ”cmath’ file not found’.
      i check out the Xcode Quick Help, it says this Always Search User Paths means the complier will search User Header Search Paths first.

      now my question is i just turn that Always Search User Paths flag on,nothing else changed, so as the Xcode Quick Help saies, complier will search User Header Search Paths first, and then search the other place,so why this ”cmath’ file not found’ comes out, it will still check the ‘cmath’ file location.

      please help me

      #892
      Bill Hollings
      Keymaster

        @yincg

        cmath is usually used in C++ libraries. Xcode will usually only search for cmath as a system header when it is referenced from a C++ source file. The error you are getting typically arises when a header file included by a non-C++ source file (C, Objective-C or Swift file) indirectly includes cmath.

        The cmath header is not used by MetalGL. I suspect that you have a header file somewhere in your User Header Search Paths that overrides (has the same name) as a system header file, and that header file is including cmath.

        Check your User Header Search Paths Xcode build setting, the header files included from that path, and the header files included in your Xcode project, to see if that is the case. Within Xcode, you could also search for references to cmath.

        If you continue to have trouble, ZIP up your Xcode project, upload it to somewhere like Dropbox, post a link to it here, and we’ll have a look at it. If you don’t want to post the link here, you can email the link to support@metalgl.com directly.

        …Bill

        #894
        yincg
        Participant

          i already Emailed you.
          and when i use MetalGL in GLAirplay(Apple’s OpenGL Demo) as a test,there comes a crash problem,like this:
          please tell me why

          #897
          Bill Hollings
          Keymaster

            @yincg

            Sorry for the delay in getting back to you. We have been very busy this week with activities associated with the Vulkan public release this week.

            If you look at the inclusion order of the error (in the attached image), you can see that the system header chain eventually tries to include a file called block.h. Unfortunately, your project also contains a file with that name, and it attempts to then include further header files in your project, eventually looking for cmath.

            As I mentioned above, the compiler does not find cmath, because it is not looking for C++ files, since the source file it is attempting to compile at the time (see the top of the list in the error) is test_project.m, which is an Objective-C file.

            You have a couple of options. The simplest is to change the name of test_project.m to test_project.mm, so that it will be compiled as Objective-C++ and will find the cmath system file. This is a sensible thing to do anyway, since your project includes a substantial third-party C++ library, and any Objective-C files that use it will need to be (.mm) files.

            The second option (for more complicated projects) is to compile the third-party library in a separate build target within your project, and leave the ALWAYS_SEARCH_USER_PATHS turned off on that project target. You only need to set the ALWAYS_SEARCH_USER_PATHS option for code that needs to include the gl.h or glext.h files when using MetalGL.

            …Bill

            #899
            yincg
            Participant

              Ok,i got this.
              But as you say if i change the file name from .m to .mm,with the setting of Always Search User Paths,the system header which try to include ‘block.h’ will still link to the file of the same name in my project, which what i don’t wanna see(cause i do not wanna change anything except the setting of MetalGL). so is that the only way that i change the file name ‘block’ to solve the problem?

            Viewing 5 posts - 1 through 5 (of 5 total)
            • The forum ‘MoltenGL Support’ is closed to new topics and replies.