Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Xcode 3

  • 27-10-2010 06:42PM
    #1
    Closed Accounts Posts: 2,663 ✭✭✭


    since my Windows PC crashed with Dul boot of Linux on it and had Netbean installed on it, i said i'll go away and download Xcode 3 and start using that but when i was doing some Arrays and pointers i was using

    using namespace std;

    void Main () ** this was showing up an Error that i need int main () as my Main ? why is Xcode not working when i have void main ()

    same goes with my Array..

    myArray[3] = {1, 2, 3}
    int mailbox

    myArray[mailbox]
    cout << (int)myArray << mailbox << endl; it wont allow me to use (int) infront of myArray anyone having problems like this with Xcode?


Comments

  • Closed Accounts Posts: 1,155 ✭✭✭Stainless_Steel


    Hi

    I'm not a coder so sorry if this sounds stupid. But doesn't Xcode use Objective C by default? Maybe your code only works with C++?


  • Closed Accounts Posts: 2,663 ✭✭✭Cork24


    Its allows you to code in C & in C++


  • Posts: 0 ✭✭✭ [Deleted User]


    why dont you use int main()?

    (void is an ms way that is not standard c++ or c = http://www2.research.att.com/~bs/bs_faq2.html#void-main)

    as a general rule if a compiler throws up a warning, follow its advice unless you think you know better but when something goes wrong remember that you were warned.


  • Closed Accounts Posts: 2,663 ✭✭✭Cork24


    just so used to void main()

    that out of the way why is xcode giving error when i have something like

    cout << (int)myArray << Mailbox << endl; ?

    Cast form 'Double*' to 'int' loses precision ? i dont have anything set to double nor have i seen this error code before never got it in netbean only with xcode

    i think i am going to have to go away and buy Vmware and install Ubuntu 10 and install netbean again. dont like the Mac Version of it i dont know why..


  • Posts: 0 ✭✭✭ [Deleted User]


    I couldn't tell you, I know limited c - I dont know c++.


    But xcode sticks to stricter standards of code than (probably) what you were used to - you were not getting errors before but that does not mean the code was 100% right.

    void main() is not valid c++ - not even valid c so I would heed the errors xcode gives you.


    Loosing accuracy? - depends on the size of the number you're using whether to use int or double.


  • Advertisement
  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    I think you might be more likely to get a better answer to this in the Development forum, so I am moving the thread there.


Advertisement