Thread: im a noob at c++, do you think so?

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    3

    im a noob at c++, do you think so?

    i cannot figure out why this keeps happening when I compile


    BEL-RASHOs-MacBook-Proesktop belrasho$ g++ lab10.cpp -o lab10
    lab10.cpp:1: error: stray ‘\’ in program
    lab10.cpp:1: error: stray ‘\’ in program
    lab10.cpp:1: error: stray ‘\’ in program
    lab10.cpp:1: error: stray ‘\’ in program
    lab10.cpp:1: error: stray ‘\’ in program
    lab10.cpp:2: error: stray ‘\’ in program
    lab10.cpp:2: error: stray ‘\’ in program
    lab10.cpp:2: error: stray ‘\’ in program
    lab10.cpp:2: error: stray ‘\’ in program
    lab10.cpp:3: error: stray ‘\’ in program
    lab10.cpp:3: error: stray ‘\’ in program
    lab10.cpp:3: error: stray ‘\’ in program
    lab10.cpp:3: error: stray ‘\’ in program
    lab10.cpp:4: error: stray ‘\’ in program
    lab10.cpp:4: error: stray ‘\’ in program
    lab10.cpp:4: error: stray ‘\’ in program
    lab10.cpp:4: error: stray ‘\’ in program
    lab10.cpp:4: error: stray ‘\’ in program
    lab10.cpp:5: error: stray ‘\’ in program
    lab10.cpp:6: error: stray ‘\’ in program
    lab10.cpp:6: error: stray ‘\’ in program
    lab10.cpp:6: error: stray ‘\’ in program
    lab10.cpp:6: error: stray ‘\’ in program
    lab10.cpp:8: error: stray ‘\’ in program
    lab10.cpp:8: error: stray ‘\’ in program
    lab10.cpp:8: error: stray ‘\’ in program
    lab10.cpp:8: error: stray ‘#’ in program
    lab10.cpp:8:34: warning: backslash-newline at end of file
    lab10.cpp:8: error: stray ‘\’ in program
    lab10.cpp:8: error: stray ‘\’ in program
    lab10.cpp:8: error: stray ‘\’ in program
    lab10.cpp:8: error: stray ‘\’ in program
    lab10.cpp:1: error: expected unqualified-id before ‘{’ token
    BEL-RASHOs-MacBook-Proesktop belrasho$

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    What are you using to edit your code? Show us the first line of your lab10.cpp file.

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    596
    Just as a wild guess, did you use a word processor (as opposed to a text editor) to write your code?

  4. #4
    Registered User
    Join Date
    Apr 2010
    Posts
    3
    I am using text editor on my macbrook pro.

    the first line of my file is #include<iostream>


    so far, i have figured out that the text editor is adding '/' for why? i dont know.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Post your code as an attachment perhaps?

    Also, if your editor has commands for "bold", "italic" etc, then it is a word processor, not a text editor.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    You mean TextEdit? What format are you saving the file as?

  7. #7
    Registered User
    Join Date
    Apr 2010
    Posts
    3
    thanks to everyones' effort. after hours of research, I have figured out a soultion to my problem.

    text editor was inserting invisible and non removable characters '/' into my code.

    By downloading textwrangler, it saved all my codes as a uTF-8 no bom.

    GO TO DOWNLOADS.COM to get textwrangler. I suggest using it instead of texteditor.

    Im a mac user

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Noob needs help :)
    By Cursius in forum C++ Programming
    Replies: 4
    Last Post: 12-11-2009, 04:19 PM
  2. Noob in need of help.
    By gec5741 in forum C++ Programming
    Replies: 18
    Last Post: 01-23-2009, 03:25 PM
  3. my noob program doesnt work
    By Scarvenger in forum C++ Programming
    Replies: 2
    Last Post: 10-19-2005, 11:40 AM
  4. noob needs help!!!!:(
    By tykenfitz in forum C Programming
    Replies: 1
    Last Post: 07-10-2005, 08:49 AM
  5. simple noob question: HWND, HDC etc.
    By freedik in forum Windows Programming
    Replies: 12
    Last Post: 08-19-2003, 03:59 AM