godfather_2000's blog

By godfather_2000, history, 5 years ago, In English

Hi, I am currently facing trouble using Xcode for the first time. Previously I used lightweight online IDEs but now I feel the need to switch to an offline one. Since I use Mac I wanted some help on how to setup Xcode for CP. Also while copying large test cases from udebug I see Xcode is not able to run on them and provide the required output. And another problem I have been facing is using the header bits/stdc++.h in Xcode. I searched for a solution online and did something like this 52770619 but over here it showed compilation error.

I would be very happy if anyone can help me.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I am not sure but I think something like

#ifndef ONLINE_JUDGE
#include "your long include line"
#else
#include <bits/stdc++.h>
#endif

should work. I haven't tested it but you can try it. Let me know if it helped!

  • »
    »
    5 years ago, # ^ |
    Rev. 4   Vote: I like it 0 Vote: I do not like it

    It worked like magic... Thanks :) Do u also use Xcode?

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      No, I don't. It was just a quick idea I had. If you want to use it on other OJs where they do not define ONLINE_JUDGE you can change the syntax a bit like

      #ifdef YOUR_DEFINE
      #include <"your long include line"
      #else
      #include <bits/stdc++.h>
      #endif
      

      and compile defining YOUR_DEFINE like you defined _DEBUG. I am glad I could help you :)