XCode 3.0 C++ cout/cin Question

When I was writing programs on 10.4 version of XCode, I could type something like:
cout << n << endl;
cin >> n;
and not get an error, but now that I'm running the 10.5 version of XCode, I have to type:
std::cout << n << std::endl;
std::cin >> n;
everytime. It doesn't matter if I include stdlib.h or cstdlib, I'll always get an error if I don't type that std::. Can somebody tell me why, and how can I get it back to the other way?

That is the C++ language. You must have been using some really old headers and/or GCC 3 on 10.4.
What you want to do is:
#include <iostream>
using namespace std;

Similar Messages

  • Compiled Error in Xcode for iphone game and other questions

    Dear all,
    Hi, I am a newbie of xcode and objective-c and I have a few questions regarding to the code sample of a game attached below. It is written in objective C, Xcode for iphone4 simulator. It is part of the code of 'ball bounce against brick" game. Instead of creating the image by IB, the code supposes to create (programmatically) 5 X 4 bricks using 4 different kinds of bricks pictures (bricktype1.png...). I have the bricks defined in .h file properly and method written in .m.
    My questions are for the following code:
    - (void)initializeBricks
    brickTypes[0] = @"bricktype1.png";
    brickTypes[1] = @"bricktype2.png";
    brickTypes[2] = @"bricktype3.png";
    brickTypes[3] = @"bricktype4.png";
    int count = 0;`
    for (int y = 0; y < BRICKS_HEIGHT; y++)
    for (int x = 0; x < BRICKS_WIDTH; x++)
    - Line1 UIImage *image = [ImageCache loadImage:brickTypes[count++ % 4]];
    - Line2 bricks[x][y] = [[[UIImageView alloc] initWithImage:image] autorelease];
    - Line3 CGRect newFrame = bricks[x][y].frame;
    - Line4 newFrame.origin = CGPointMake(x * 64, (y * 40) + 50);
    - Line5 bricks[x][y].frame = newFrame;
    - Line6 [self.view addSubview:bricks[x][y]]
    1) When it is compiled, error "ImageCache undeclared" in Line 1. But I have already added the png to the project. What is the problem and how to fix it? (If possible, please suggest code and explain what it does and where to put it.)
    2) How does the following in Line 1 work? Does it assign the element (name of .png) of brickType to image?
    brickTypes[count ++ % 4]
    For instance, returns one of the file name bricktype1.png to the image object? If true, what is the max value of "count", ends at 5? (as X increments 5 times for each Y). But then "count" will exceed the max 'index value' of brickTypes which is 3!
    3) In Line2, does the image object which is being allocated has a name and linked with the .png already at this line *before* it is assigned to brick[x][y]?
    4) What do Line3 and Line5 do? Why newFrame on left in line3 but appears on right in Line5?
    5) What does Line 4 do?
    Thanks
    North

    Hi North -
    macbie wrote:
    1) When it is compiled, error "ImageCache undeclared" in Line 1. ...
    UIImage *image = [ImageCache loadImage:brickTypes[count++ % 4]]; // Line 1
    The compiler is telling you it doesn't know what ImageCache refers to. Is ImageCache the name of a custom class? In that case you may have omitted #import "ImageCache.h". Else if ImageCache refers to an instance of some class, where is that declaration made? I can't tell you how to code the missing piece(s) because I can't guess the answers to these questions.
    Btw, if the png file images were already the correct size, it looks like you could substitute this for Line 1:
    UIImage *image = [UIImage imageNamed:brickTypes[count++ % 4]]; // Line 1
    2) How does the following in Line 1 work? Does it assign the element (name of .png) of brickType to image?
    brickTypes[count ++ % 4]
    Though you don't show the declaration of brickTypes, it appears to be a "C" array of NSString object pointers. Thus brickTypes[0] is the first string, and brickTypes[3] is the last string.
    The expression (count++ % 4) does two things. Firstly, the trailing ++ operator means the variable 'count' will be incremented as soon as the current expression is evaluated. Thus 'count' is zero (its initial value) the first time through the inner loop, its value is one the second time, and two the third time. The following two code blocks do exactly the same thing::
    int index = 0;
    NSString *filename = brickTypes[index++];
    int index = 0;
    NSString *filename = brickTypes[index];
    index = index + 1;
    The percent sign is the "modulus operator" so x%4 means "x modulo 4", which evaluates to the remainder after x is divided by 4. If x starts at 0, and is incremented once everytime through a loop, we'll get the following sequence of values for x%4: 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, ...
    So repeated evaluation of (brickTypes[count++ % 4]) produces the sequence: @"bricktype1.png", @"bricktype2.png", @"bricktype3.png", @"bricktype4.png", @"bricktype1.png", @"bricktype2.png", @"bricktype3.png", @"bricktype4.png", @"bricktype1.png", @"bricktype2.png", ...
    3) In Line2, does the image object which is being allocated has a name and linked with the .png already at this line *before* it is assigned to brick[x][y]?
    Line 2 allocs an object of type UIImageView and specifies the data at 'image' as the picture to be displayed by the new object. Since we immediately assign the address of the new UIImageView object to an element of the 'bricks' array, that address isn't stored in any named variable.
    The new UIImageView object is not associated with the name of the png file from which its picture originated. In fact the UIImage object which inited the UIImageView object is also not associated with that png filename. In other words, once a UIImage object is initialized from the contents of an image file, it's not possible to obtain the name of that file from the UIImage object. Note when you add a png media object to a UIImageView object in IB, the filename of the png resource will be retained and used to identify the image view object. But AFAIK, unless you explicitly save it somewhere in your code, that filename will not be available at run time.
    4) What do Line3 and Line5 do? Why newFrame on left in line3 but appears on right in Line5?
    5) What does Line 4 do?
    In Line 2 we've set the current element of 'bricks' to the address of a new UIImageView object which will display one of the 4 brick types. By default, the frame of a UIImageView object is set to the size of the image which initialized it. So after Line 2, we know that frame.size for the current array element is correct (assuming the image size of the original png file was what we want to display, or assuming that the purpose of [ImageCache loadImage:...] is to adjust the png size).
    Then in Line 3, we set the rectangle named newFrame to the frame of the current array element, i.e. to the frame of the UIImageView object whose address is stored in the current array element. So now we have a rectangle whose size (width, height) is correct for the image to be displayed. But where will this rectangle be placed on the superview? The placement of this rectangle is determined by its origin.
    Line 4 computes the origin we want. Now we have a rectangle with both the correct size and the correct origin.
    Line 5 sets the frame of the new UIImageView object to the rectangle we constructed in Lines 3 and 4. When that object is then added to the superview in Line 6, it will display an image of the correct size at the correct position.
    - Ray

  • CIN Question

    We produce product A in India,We sell this product A to customers in different tradenames (B, C and D).
    According to our Indian business there is "legal" requirement to have 1=1 match for product name (production-sell).
    Can you check if there have been similar issues with your previous SAP/CIN implementations in India and what has been the solution?
    Can we for example modify our CIN reports or use some other approach in official reporting to show that our production material description matches our sales description.
    Please Advise
    Regards,
    Raj

    The options are as below:
    1.    Maintaining the same material code, also maintain Customer Material Info Record in Transaction VD51. In Customer Material Info Record, maintain in description the material code / description which is customer specific. This is ideal, as it is your books of accounts for accounting and excise purpose.
    2.    If you want to reflect the material as separate material, maintain the same as separate Material Code. In this scenario, you may at times require to move stock from one code to another, which should be possible through MM Module.
    I have followed option 1 in our implementations for such requirements.
    Regards,
    Rajesh Banka

  • Question about 'cin' & 'cout' (C++) (SOLVED)

    Probably a stupid question with a simple answer but here goes;
    when i compile the following code
    #include <iostream>
    #include <string>
    int main(int argc, char* argv[])
    string buffer;
    while (1 == 1)
    cout<<" ## ";
    cin>>buffer;
    it compiles fine, when run it does the following
    prints " ##  " minus quotes
    then pauses for input
    however the strange thing is that if i enter a string with a space in, quotes or no, it repeats the 'cout' statement, see below for output
    ##  this is a string
    then pauses for input, as it should, i ask you why it does this as i don't call it "expected behaviour", not with that code anyway.
    EDIT: fixed some typos
    EDIT_2: boxed of output&code, thx ewaller
    Last edited by Iknow (2011-06-25 23:39:13)

    Nah, there is a loop, right?
    You type "this is a string".
    cin reads "this" and gets out.
    while(1 == 1) is tested and gets in (of course).
    cout prints " ## ". (*)
    cin reads "is" and gets out.
    etc.
    (*) The thing why it gets "mixed" (I mean you type the whole string and then ## * 4 appears) is probably because terminal is flushing (and thus refreshing) stdout on Enter hit only.

  • Xcode debugger question

    How do i setup the debugger in xcode?

    The debugger is already setup in Xcode, do you have a specific question?

  • Universal CINs? (For MacOS 10.4 and Intel Macs)

    Hi!
    1. I was wondering if it was possible to build a Universal CIN for MacOS 10.4, in order to support Intel Macs. If so how? I get link errors in Xcode because it cannot find CIN functions such as MoveBlock, and NumericArrayResize when compiling for i386 (which is understandable). Is there an Intel Mac version of liblabviewcin.a and liblvexports.a?
    2. Is it possible for LabVIEW to call a DLL function in a Universal framework? Or must all frameworks be for the PowerPC?
    Thanks.

    I am trying to invoke code external to LabVIEW that contain AltiVec and in the future, SSE instructions. Right now I am trying to bundle PowerPC code (with AltiVec instructions) with Intel i386 code to support both PowerPC and Intel Macs using a single binary.
    So basically I have:
    1. A CIN that uses AltiVec currently (which includes AltiVec instructions). I would prefer that it switched to a SSE version automatically when I call the CIN on an Intel Mac.
    2. Some VIs that uses the Call Library Function Node to invoke a function in a Universal Framework. The framework is compiled for both PowerPC and Intel. The PowerPC version includes AltiVec instructions and thus is incompatible with Rosetta. I was wondering if LabVIEW would actually be able to invoke such a function successfully on an Intel Mac. I don't have an Intel Mac on hand, which is why I am asking.
    PS: The original post was posted using NI JT's account accidentally. The question is actually mine.

  • How to view C/C++   pointer as an array in Xcode GUI debugger?

    How to view C/C++ pointer as an array in Xcode GUI debugger?

    A similar question was asked recently regarding strings. You cannot pass pointers in LabVIEW as you do in C. You can pass an array to a DLL, but that means you would need to write a wrapper DLL. Be sure to read the section in the LabVIEW Help on calling code from text-based languages and also take a look at the "Call DLL" example that ships with LabVIEW  - it contains many examples of how to deal with various datatypes.

  • Learn C on the mac questions...

    Hello everybody,
    I'm just starting to learn programming. I choose to start with the book Learn C on the Mac - Dave Mark.He wrote the book while using xCode 3.1
    I have 2 questions.
    First: Every Project that came with the book, when i  try to open one in xcode after build and run it brings the error "There is no SDK with the name or path 'macosx'
    Second: The book talks about Syntax and Semantic errors and how to produce then to learn from it so suppose to apperar something like "error: syntax error before '{'  token"  but Xcode only give me "Expected indentifier or '('
    Are those because my version of Xcode (3.2.2) or I'm doing something wrong?
    I will appreciate your answers and comments.
    Thanks

    Your first problem is caused by the book projects using an older version of the Mac OS X SDK that you do not have installed on your Mac. The fix is to set the Base SDK for the projects to one that is installed on your Mac. In Xcode 3.2 choose Project > Edit Project Settings to open the project inspector. Select the General tab in the inspector. Use the Base SDK for All Configurations menu in the inspector to set the SDK. You should set it to Mac OS X 10.6.
    Regarding your second question, I would not worry about the compiler error message not matching exactly what the book says. What is important to know that you have a syntax error, why you have one, and how to correct it. I assume the book explains the why and how.

  • MAS xCode and  Developer xCode

    I have a 99 dollar a year dev license and can receive xCode for free, but even though I am signed into the same Apple ID, the xCode program in MAS still shows as being $4.99.
    In the hopes of being able to consolidate my future updates and updating processes for xCode and SDK's using MAS instead of manually downloading from the dev site, I clicked on the "buy it" button. My Mac then began downloading xCode through MAS even though I already had the latest version of xCode installed.
    Now to my questions, is this version of xCode going to overwrite my previous install even though it is the same version or will it install 2 instances (double disk space)? Does xCode from MAS include all the IOS and Mac SDKs, or are those only available through the dev download? And lastly is it possible to cancel a purchase in the MAS once it has been made, in case I can't just use MAS as my stand alone updater for xCode?

    It appears from the comments to be the same app. This is a different distribution channel aside from the developer program. The only way to opt into the MAS is to buy. When I bought an update through the MAS for a product that I had earlier obtained from a different source it was replaced by the MAS version.
    YMMV.
    Dah•veed

  • Can u

    Hi Experts
    can any body send the answers bellow this questions?
    CIN Questions
    What is excise duty?
    What is excise group?
    Which business processes are covered under CIN?
    Which t-code display CIN menu?
    What master data set up is required before CIN customization can take effect?
    How many types of registers are there to be maintained in CIN?
    How does system know that which register to update during GR?
    How the CIN registers are updated?
    What do you mean by extraction and printing of Registers?
    What is the difference between the tax procedure TAXINJ and TAXINN?
    How does system know that which condition types in tax procedure and import pricing procedure are CIN relevant?
    How does system differentiate between deductible excise duty and non-deductible excise duty?
    What are the purpose of condition types NAVS, JEXS and JEXC in pricing procedure?
    What is the purpose of subtotal 5 & 6 in the pricing procedure?
    What setting do we need to do so tax code can work during creation of purchase order and sales order?
    What are the excise transaction types (ETT)?
    What is sub-transaction type?
    Which settings determine that during MIGO transaction, excise invoice can be captured (posting of part I entry) or Pos
    What CIN settings are required if we have to do STO between two manufacturing plants or between manufacturing an
    Why should a STO (stock transport order) have pricing procedure?
    Explain domestic procurement at manufacturing unit?
    Explain domestic and import procurement at depot plant?
    What needs to be done if the Excise Invoice quantity is not equal to GR quantity?
    Is the depot plant process applicable to all the industry sectors?
    Explain import procurement at manufacturing unit?
    Explain STO process from manufacturing unit to Depot Plant
    What is the functionality of the rejection code/reason code?
    Specify which movement types involve either excise invoices or part 1 entry of register or both
    In the subcontracting attributes (CIN IMG) what is the difference between Movement Type Group Issues and Moveme
    What are two different possible scenarios for subcontracting process?
    How is the recursive BoM scenario (the parent and the child material being the same) handled in subcontracting?
    For which of the movements will I run the Quantity Reconciliation for the subcontracting Challan?
    How do I delete challans assigned to the Goods Receipts document?
    How will you handle sales return from customer?
    How will you handle vendor return and GR cancellation?
    How does system determine accounts to be posted for CIN registers?
    How does fortnightly utilization determine the accounts to be posted?
    What is transaction type u2018UTLZu2019 used for?
    What will be the accounting entry during GR of raw material, Excise invoice posting and subsequent LIV of material?
    What should be accounting entry in subcontracting reversal / Recredit?
    What will be the accounting entry during GR of capital material, Excise invoice posting and subsequent LIV of materia
    How does the credit of the amount taken which has gone to Cenvat ON Hold account?
    Under what circumstances we may need to transfer the credit amount (against a specific invoice) from Cenvat ON Ho
    How the accounts are determined when capital goods are procured?
    What will be the accounting entry during scrapping of excisable goods?
    What will be accounting entry when the materials are stock transferred from manufacturing unit to depot plant?
    What will be the accounting entry for sales excise invoice?
    What will be accounting entry during PLA entry and utilization?
    What is utilization? How do we execute it in CIN?
    How do we take utilization against service tax receivable and payable?
    What are PLA and TR6C Challan?
    What are the number range objects for which number range should be defined?
    What is export under bond?
    Edited by: madhusap01 on Dec 22, 2011 12:04 PM
    Moderator: Why only 30 questions? You should have posted at least 300; otherwise, no answer can be given

    We don't unlock phones here. If your phone came from another carrier and you need it unlocked to work on yours, you can do a search on the internet for people who will unlock your phone.
    If you've used up all your attempts to unlock your MEP code, only BlackBerry can help you (we're not BlackBerry employees, we're users like you who volunteer to help out). You'll need to contact your carrier to get access to BlackBerry to perform this function.
    And finally, please edit your post and remove your PIN number. Posting it in these forums is not permitted.
    Cheers.  
    - If my response has helped you, please click "Options" beside my post and mark it as solved. Clicking the "thumbs up" icon near the bottom of my response would also be appreciated.

  • Japanese Character Display

    Sorry for such a newbie question.
    My program reads in a UTF-8 file containing some Japanese characters, stores them into a String variable and then attempts to print using: System.out.println(myString); . However, it doesn't display correctly in XCode or the Terminal (shows mostly question marks). When I follow it in the debugger, the Japanese characters show up correctly stored in the variable. Also, if I just do: System.out.println("japaneseCharacters"); where japaneseCharacters are actual japaneseCharacters, they print out correctly. I've made sure that my source files, the file being read in, and the terminal are both set to UTF-8. Can somebody point me in the right direction?
    Thanks!

    I believe yours is a application specific or platform specific problem.
    when you write a code:
    System.out.println("japaneseCharacters");what tool did you use? What is the locale setting of your platform?.
    On our Linux platform, locale is ja_JP.UTF-8. So we need explicit charset argument
    for encodings other than Japanese/UTF8 in using Java API classes and methods.
    As many applications including editors rely on the locale ja_JP.UTF-8, we need special
    configuration for handling other encodings as EUC-JP or Shift_JIS.

  • C++ programmer  needs help in Java.

    Greetings, I am new to Java after programming in C++ and am having a few troubles finding parallels to a few essential operations, such as:
    What are the Java equivalents to cout, cin and getch()?
    Or simply, how do you do output, get input from the user, and pause execution?
    Thank you all for any help you can offer.
    Dagkhi

    Look over this group of threads that a search of the Forum using "system.in" listed:
    http://search.java.sun.com/search/java/index.jsp?col=javaforums&qp=%2Bforum%3A54&qt=system.in&x=14&y=6

  • Flashbuilder 4 giving problem in flex sdk 4.5.0 and 4.5.1

    Hi,
    I have flash builder 4 installed in windows xp OS.
    While developing AIR application in flash builder + flex sdk 4.0 it is fine and showing the application windows.
    But when i use flex 4.5.0 or flex 4.5.1 sdk the window doesnot show.
    After i have changed the workspace it gives the following problem.
    Process terminated unexpectedly.
    error while loading initial content
    Launch command details:
    "C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\4.5.1\bin\adl.exe" -runtime
    "C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\4.5.1\runtimes\air\win"
    "C:\Documents and Settings\sudhansu_rana\Adobe Flash Builder 4\TestAir\bin-debug\TestAir-app.xml"
    "C:\Documents and Settings\sudhansu_rana\Adobe Flash Builder 4\TestAir\bin-debug"
    Thanks
    Sudhansu

    Update your XCode to 4.3.2
    Your question should be in developer forum
    Developer Forums

  • -verbose output on Windows

    Hi all,
    I've been working using JNI to call Java methods from a Windows command-line app, that's written in C++. Recently I've moved part of the application into a windows GUI app. I use the -verbose:jni option string to get the JVM jni debug output, in the command line tool, this appears on the console along with anything else that I printf with or whatever. Now that I am using a GUI app, there is no console available. I have tried creating a new console with AllocConsole() and tried remapping stdout, stdin, stderr, cout, cin, clog and cerr to the new console. I've tested this works using printf, fprintf(stdout, ...) and about every other combination that I can think of to print to the new console that I have created, and all of my output appears, however the -verbose output does not.
    Does anyone know how to redirect this output to a new console (or just anywhere that I can read it). I've also tried calling System.setOut() etc. and pointed them to files. This lets me see things like the output from ExceptionDescribe(), but the -verbose output is still sadly missing.
    Thanx,
    Idries

    Recently I've moved part of the application into a
    windows GUI app. I use the -verbose:jni option string
    to get the JVM jni debug output, in the command lineI have found no solution to this. I tried even redirecting stdout/stderr from C before loading the VM with the Invocation API. Even this did not work. Maybe you would have better luck with it.
    Since I was only interested in GC messages the -Xloggc:filename option worked for me. But there is no -Xlogjni option unfortunately.
    A last resort option is to download the JVM source, modify it to send -verbose output always to the vfprintf hook, and use Invocation API to set that. But you would have to rebuild the VM for that. You could always look through the source for clues. I suspect that the VM will use the vfprintf hook even on Windows if it cannot open stderr.

  • IOS 5.0 and iPhone along with "new user account"

    I do hate this hacking aspect of all software, but with iTunes especially.
    Earlier I tried to remove some duplicates in the iTunes on my old computer, but time after time they popped back from the trash can, what the heck!
    There was a running computer with my iTunes account and everything was fine. Later I even made a restore to new phone after previous phone got lost.
    Then I had to buy new laptop to replace the old as it got broken.
    As instructed, I installed iTunes onto the new computer and was able to connect my Apple Store account and purchased Apps.
    Then after I copied everything in the Apple Computer - folders and iTunes in my old (same user account name) to the new computer, now running with Windows 7 (former laptop had XP).
    Now my iPhone 4 (iOS 5.0) does not sync.
    Sync failed to start...
    Also I wonder what is the reason not to be able to sync back from the handheld? Nokia has that and it really works. When I have new contacts and restore from backup I loose my contacts, since there is no sync file on the new computer. Why the system does not work automatically and sync back from the phone, if no source files found on the computer? The back sync coud be asked every time new phone or ipod/pad is connected.
    Im starting to be absolutely fed up with this constant browsing through discussions forums and what ever hacking pages to get things running that I'm just about to throw the device into the lake next to my house. AAARGH!
    Why do we even accept this? Who would buy or use a car, that had to be repaired or re-booted every 10 miles?
    Great jobs!
    Change over was, is from Samsung NC20 (WinXP) to HP Probook 5330m (Winows 7)

    Update your XCode to 4.3.2
    Your question should be in developer forum
    Developer Forums

Maybe you are looking for

  • Xf86-video-intel 2.4.2-1 has "spontaneous" lockups

    I've been quite happy with my Arch installation on my Dell XPS M1330, which I purchased about a month ago.  I have used Arch quite a bit before for servers and virtual machines, but this is my first time using it as a "regular" desktop system. Anyway

  • How do I save my TPC-2006 app in nonvolatil​e flash

    I've used the TPC Configurator to run my user interface Labview code automatically after the TPC-2006 boots up, but the file is lost every time power is cycled.  How do I make it stick to the flash disk? Jeff Climbing the Labview learning curve! Sana

  • 10.1.3.3 setup Java problem when upgrading from 10.1.3.2

    Hi guys! I have a problem with upgrade from 10.1.3.2 to 10.1.3.3 on Windows The documentation is old what you can download! So I cannot find anything. The Infrastructure Installation and Configuration Guide is for 10.1.3.2.1 and from april 2007 The I

  • DropDown By Index for a Column in ALV

    Hi, I am trying to create a dropdown for a column in ALV. I have used the following code for the same. data:           lr_drdn_by_index type ref to cl_salv_wd_uie_dropdown_by_idx.         create object lr_drdn_by_index           exporting            

  • Open Hub Destination in detail

    Hi Experts, My requirement is to transfer data from BI 7.0 to Non SAP Application but i am not sure how the data will transferred to destination and how the data will be retrieved from destination to Non SAP Application. 1.Flat file: Destination:file