YouCompleteMe is not finding some (but not all) SDL functions and also not finding std::string











up vote
0
down vote

favorite












So I'm trying to edit a C++ file which uses SDL. I've included the SDL header:



#include <SDL2/SDL.h>


and the file compiles fine. This is all on my MacOS machine. However, when I enter vim, YCM claims that some (but not all) SDL type names are "unknown." Specifically, it can't seem to find the following:



SDL_Surface
SDL_Window
SDL_WINDOWPOS_UNDEFINED
SDL_WINDOWPOS_SHOWN


It also can't seem to find std::string (yes, I included <string>).



On my Ubuntu machine, using the same .ycm_extra_conf.py file as on my Mac machine, I don't run into these issues at all.



Here are the flags from my .ycm_extra_conf.py file:



flags = [
'-Wno-unused-variable',
'-Wall',
'-lSDL2',
'-x',
'c++',
'-std=c++11',
'-stdlib=libc++',
]


Also, this may be relevant: when I try compiling the program with clang with exactly these flags, I get a linker error, but when I compile with clang++, it compiles just fine.










share|improve this question




























    up vote
    0
    down vote

    favorite












    So I'm trying to edit a C++ file which uses SDL. I've included the SDL header:



    #include <SDL2/SDL.h>


    and the file compiles fine. This is all on my MacOS machine. However, when I enter vim, YCM claims that some (but not all) SDL type names are "unknown." Specifically, it can't seem to find the following:



    SDL_Surface
    SDL_Window
    SDL_WINDOWPOS_UNDEFINED
    SDL_WINDOWPOS_SHOWN


    It also can't seem to find std::string (yes, I included <string>).



    On my Ubuntu machine, using the same .ycm_extra_conf.py file as on my Mac machine, I don't run into these issues at all.



    Here are the flags from my .ycm_extra_conf.py file:



    flags = [
    '-Wno-unused-variable',
    '-Wall',
    '-lSDL2',
    '-x',
    'c++',
    '-std=c++11',
    '-stdlib=libc++',
    ]


    Also, this may be relevant: when I try compiling the program with clang with exactly these flags, I get a linker error, but when I compile with clang++, it compiles just fine.










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      So I'm trying to edit a C++ file which uses SDL. I've included the SDL header:



      #include <SDL2/SDL.h>


      and the file compiles fine. This is all on my MacOS machine. However, when I enter vim, YCM claims that some (but not all) SDL type names are "unknown." Specifically, it can't seem to find the following:



      SDL_Surface
      SDL_Window
      SDL_WINDOWPOS_UNDEFINED
      SDL_WINDOWPOS_SHOWN


      It also can't seem to find std::string (yes, I included <string>).



      On my Ubuntu machine, using the same .ycm_extra_conf.py file as on my Mac machine, I don't run into these issues at all.



      Here are the flags from my .ycm_extra_conf.py file:



      flags = [
      '-Wno-unused-variable',
      '-Wall',
      '-lSDL2',
      '-x',
      'c++',
      '-std=c++11',
      '-stdlib=libc++',
      ]


      Also, this may be relevant: when I try compiling the program with clang with exactly these flags, I get a linker error, but when I compile with clang++, it compiles just fine.










      share|improve this question















      So I'm trying to edit a C++ file which uses SDL. I've included the SDL header:



      #include <SDL2/SDL.h>


      and the file compiles fine. This is all on my MacOS machine. However, when I enter vim, YCM claims that some (but not all) SDL type names are "unknown." Specifically, it can't seem to find the following:



      SDL_Surface
      SDL_Window
      SDL_WINDOWPOS_UNDEFINED
      SDL_WINDOWPOS_SHOWN


      It also can't seem to find std::string (yes, I included <string>).



      On my Ubuntu machine, using the same .ycm_extra_conf.py file as on my Mac machine, I don't run into these issues at all.



      Here are the flags from my .ycm_extra_conf.py file:



      flags = [
      '-Wno-unused-variable',
      '-Wall',
      '-lSDL2',
      '-x',
      'c++',
      '-std=c++11',
      '-stdlib=libc++',
      ]


      Also, this may be relevant: when I try compiling the program with clang with exactly these flags, I get a linker error, but when I compile with clang++, it compiles just fine.







      c++ macos vim sdl youcompleteme






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 5 at 3:31

























      asked Nov 5 at 3:26









      ubadub

      1,931820




      1,931820





























          active

          oldest

          votes











          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%2f53147918%2fyoucompleteme-is-not-finding-some-but-not-all-sdl-functions-and-also-not-findi%23new-answer', 'question_page');
          }
          );

          Post as a guest





































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53147918%2fyoucompleteme-is-not-finding-some-but-not-all-sdl-functions-and-also-not-findi%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          這個網誌中的熱門文章

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud

          Zucchini