Thread: I know this sounds stupid.....

  1. #1
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    499

    Angry I know this sounds stupid.....

    I know this sounds really, really, stupid, and I've used this statement a lot on Visual C++, but this is how it works: I recently went to Xcode 2, and was trying to use new to allocate memory for my pointer, but Xcode didn't like it when I tried to compile! Said something about "new" being undeclared.

    These are the headers I'm using:

    Code:
    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    #include <stdarg.h>

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    I've never heard of Xcode 2. If it's a C++ compiler and it doesn't know what new is, I wouldn't use it.
    Sent from my iPadŽ

  3. #3
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483
    you shouldn't need any header files for new.

    Maybe its a C compiler?

    EDIT: Also those are outdated header files.
    Code:
    #include <iostream>
    #include <string>
    using namespace std;
    My Website
    010000110010101100101011
    Add Color To Your Code!

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    If it's a C++ compiler and it doesn't know what new is, I wouldn't use it.
    lol.

    Said something about "new" being undeclared.
    It sounds like you made a syntax error. Post the code.

  5. #5
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    499
    Quote Originally Posted by SlyMaelstrom
    I've never heard of Xcode 2.
    That. I forgot to mention that Xcode 2 is the only C++ compiler for the Mac OS X platform that's worth it. Made by Apple.

    No, there is nothing wrong with the code. I'm not that dumb as not to know how to use new.

    you shouldn't need any header files for new.
    Oh. Well I think it's probably some compiler setting that needs changing, because when I try to put any C++ specific code in there, the compiler doesn't like it.

    And no, it's not just a C compiler. I compiled a C++ program just the other day without any errors.

  6. #6
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    499
    Never mind. It works now. I just had to fool around enough with the compiler settings.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorry for my question if it sounds stupid
    By (::) in forum Networking/Device Communication
    Replies: 6
    Last Post: 05-16-2008, 10:36 PM
  2. stupid, stupid question
    By xelitex in forum C++ Programming
    Replies: 5
    Last Post: 12-22-2004, 08:22 PM
  3. Incredibly Stupid People
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 09-09-2003, 04:12 PM
  4. Companies and their stupid interview questions...
    By Cheeze-It in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 01-30-2003, 06:00 PM
  5. Sounds, or no sounds?
    By face_master in forum C++ Programming
    Replies: 3
    Last Post: 09-03-2001, 05:29 PM