Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Help with Text Wrangler
    Hexen's Avatar
    Member Since
    Sep 25, 2011
    Location
    San Antonio, TX
    Posts
    52
    Specs:
    MacBook Pro 13"(Early 2011) 2.3 Ghz Intel Core i5 Mac OS X 10.8.2
    Help with Text Wrangler
    I've been using Text Wrangler for a day and I've programmed in Perl, Python, and Shell Script already, but when I try to program in C++, I'm stuck in a rut. If I include the shebang line #!/usr/bin/gcc I get a C++ error that says "invalid preprocessing directive." If I remove the shebang line, I get a Text Wrangler error. Anybody know how to get rid of these errors?

  2. #2
    Help with Text Wrangler
    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Location
    Tucson, AZ
    Posts
    6,821
    Specs:
    Way... way too many specs to list.
    Ohhhhhhhh remove the shebang, save the file in textwrangler then compile it. Yea, #!/usr/bin/gcc won't work.. and I don't think textwrangler will actually run the compiler
    mike
    This machine kills fascists
    Got # ? phear the command line!

  3. #3
    Help with Text Wrangler
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,396
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    You really only need the shebang line for interpreted languages. It works to tell your shell how to execute a script if it has executable privileges. For example, let's say you have a Python script and you make it executable (so you don't have to invoke the Python interpreter). The shebang at the beginning tells the shell that this is a Python script that needs to be interpreted by Python.

    Since C/C++/Obj-C compile to native code, the shebang is useless since no interpreter needs to be invoked. In those languages, the hash mark actually signifies something else (preprocessor directives). Valid examples include #define and #include and invalid examples include your shebang line.

    As dys said, remove it and try again.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  4. #4
    Help with Text Wrangler
    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Location
    Tucson, AZ
    Posts
    6,821
    Specs:
    Way... way too many specs to list.
    If you want to run your code, from within your development software, you're gonna need an IDE.. well, you already have xCode
    mike
    This machine kills fascists
    Got # ? phear the command line!

  5. #5
    Help with Text Wrangler
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,396
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    Quote Originally Posted by Dysfunction View Post
    If you want to run your code, from within your development software, you're gonna need an IDE.. well, you already have xCode
    Pfft, Vim can handle it just fine:
    Code:
    :!gcc %
    :!./a.out
    Or, better yet:
    Code:
    :!gcc % -o name_of_app
    :!./name_of_app
    Who needs an IDE?
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  6. #6
    Help with Text Wrangler
    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Location
    Tucson, AZ
    Posts
    6,821
    Specs:
    Way... way too many specs to list.
    hey, I may be a cli guy... but I still don't feel right pushing people into vi
    mike
    This machine kills fascists
    Got # ? phear the command line!

  7. #7
    Help with Text Wrangler
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,396
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  8. #8
    Help with Text Wrangler
    Hexen's Avatar
    Member Since
    Sep 25, 2011
    Location
    San Antonio, TX
    Posts
    52
    Specs:
    MacBook Pro 13"(Early 2011) 2.3 Ghz Intel Core i5 Mac OS X 10.8.2
    That's what I had to do. I had to compile it through Terminal using g++ -o, and then running the executable. I hate C++, I've been trying to configure Eclipse to run it. When I first tried I couldn't build the binaries, then after that I get an error message about the architecture that I read was caused by OS X being 64-bit. So I tried Text Wrangler, and I had problems too! But I have it now, I guess. I just have to turn all my files into executable files, but I made it easier on myself by creating aliases to do it easier and quicker. I know everyone says to use Xcode, but truth be told, I don't really like Xcode. It's too bloated for me Thanks for all the replies.

  9. #9
    Help with Text Wrangler
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,396
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    Quote Originally Posted by Hexen View Post
    I just have to turn all my files into executable files, but I made it easier on myself by creating aliases to do it easier and quicker.
    There's no way around this - C++ is a compiled language. You can not interpret C++ code for it wasn't designed that way and never has been.

    If you hate C++, might I ask why you're using it?
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  10. #10
    Help with Text Wrangler
    Hexen's Avatar
    Member Since
    Sep 25, 2011
    Location
    San Antonio, TX
    Posts
    52
    Specs:
    MacBook Pro 13"(Early 2011) 2.3 Ghz Intel Core i5 Mac OS X 10.8.2
    Because I read that it's the lingua franca of programming languages and I've seen it for myself. Like I said before, I learned Java last semester and I can understand bits and pieces of other languages because of Java's similarities to C/C++, and I like that. Not only that, but from what I've read, C++ has a wider possibility of applications than Java. Yeah I know, all of this is based on other people's testimonials, but I take their word for it. Besides, it can't hurt to know another language, right? I guess I don't hate C++, because I really haven't been able to program in it.

  11. #11
    Help with Text Wrangler
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,396
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    I suppose it's the lingua franca for certain requirements but this all depends on what you want to accomplish. If you want to do lower level programming, C is the way to go. For other projects, C is a terrible choice (relationally). What kinds of things do you want to develop?
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  12. #12
    Help with Text Wrangler
    Hexen's Avatar
    Member Since
    Sep 25, 2011
    Location
    San Antonio, TX
    Posts
    52
    Specs:
    MacBook Pro 13"(Early 2011) 2.3 Ghz Intel Core i5 Mac OS X 10.8.2
    I have no idea yet, I have a year and a half to figure it out though Probably programs on a professional level, but I also have an interest in programming hardware (musical applications like the Noise Toy), in which case I assume C would be good since it's lower level. Honestly, I'm just trying to learn as much as possible right now.

  13. #13
    Help with Text Wrangler
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,396
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    Oh, please don't let my questions and comments deter you from learning as much as possible. That's very much not the case. Learn as much as you can now while you have the freedom to do so.

    If you're going to be doing hardware level programming, the "C languages" are definitely worth some attention (and Assembly depending how "far down" you want to go). You may not like it for some higher level stuff but it can definitely be used since most major programs involve a "C language" somewhere. I can't speak to your preference though - that's all you.

    Admittedly, part of my questioning comes out of my dislike for C/C++/Obj-C and strong preference for Python and Javascript.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  14. #14
    Help with Text Wrangler
    Hexen's Avatar
    Member Since
    Sep 25, 2011
    Location
    San Antonio, TX
    Posts
    52
    Specs:
    MacBook Pro 13"(Early 2011) 2.3 Ghz Intel Core i5 Mac OS X 10.8.2
    Ha! Hopefully the freedom doesn't ever go away...

    I don't want to even think about Assembly, there is no way that I would ever want to go that far. I'll be happy learning C in some variation. But I've been playing around with C++ all day--it's my last day of vacation, and I'm programming!--and it does seem like it's not the best language for higher level tasks, but I'm sure it does have it's applications.

    I've been looking into Python too. I have Ubuntu installed as a Virtual Machine on my Mac, and I've looked at some of the files and it looks like a promising language. I've played around with it a bit on Terminal, but I'm looking for a good tutorial at the moment.

    What do you have against C? I've seen a lot of people on various forums that have nothing good to say about C.

  15. #15
    Help with Text Wrangler
    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,396
    Specs:
    2012 13" MBP (2.5 i5, 8GB)
    It's unforgiving and doesn't have a garbage collector. I also don't like the syntax but that's a fairly minor point in the grand scheme of things.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Quicktime QTtext, offset text file using text track.
    By Jesse Smith in forum OS X - Apps and Games
    Replies: 0
    Last Post: 03-14-2014, 03:05 PM
  2. How to edit text in text form control ms word 2011?
    By aynat218 in forum OS X - Apps and Games
    Replies: 1
    Last Post: 02-08-2012, 02:38 PM
  3. Rich Text/Plain Text problem
    By camel77 in forum OS X - Operating System
    Replies: 1
    Last Post: 12-08-2009, 12:14 PM
  4. Replies: 1
    Last Post: 10-28-2009, 09:36 AM
  5. Text to speech - Turn text into audio file
    By jimz in forum OS X - Apps and Games
    Replies: 1
    Last Post: 07-19-2006, 08:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •