New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus • Advice and insight from world-class Apple enthusiasts • Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Apps and Games Discussion of applications and games available for Mac OS X.

Help with Text Wrangler


Post Reply New Thread Subscribe

 
Thread Tools
Hexen

 
Hexen's Avatar
 
Member Since: Sep 25, 2011
Location: San Antonio, TX
Posts: 52
Hexen is on a distinguished road
Mac Specs: MacBook Pro 13"(Early 2011) 2.3 Ghz Intel Core i5 Mac OS X 10.8.2

Hexen is offline
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?
QUOTE Thanks
Dysfunction

 
Dysfunction's Avatar
 
Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,620
Dysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant future
Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff

Dysfunction is offline
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!
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Ottawa
Posts: 17,099
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
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
Mac-Forums Investigates MacKeeper - Confused about MacKeeper? Take a look at this review.
QUOTE Thanks
Dysfunction

 
Dysfunction's Avatar
 
Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,620
Dysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant future
Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff

Dysfunction is offline
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!
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Ottawa
Posts: 17,099
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
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
Mac-Forums Investigates MacKeeper - Confused about MacKeeper? Take a look at this review.
QUOTE Thanks
Dysfunction

 
Dysfunction's Avatar
 
Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,620
Dysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant futureDysfunction has a brilliant future
Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff

Dysfunction is offline
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!
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Ottawa
Posts: 17,099
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
macvim - Vim for the Mac - Google Project Hosting - Problem solved!

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Mac-Forums Investigates MacKeeper - Confused about MacKeeper? Take a look at this review.
QUOTE Thanks
Hexen

 
Hexen's Avatar
 
Member Since: Sep 25, 2011
Location: San Antonio, TX
Posts: 52
Hexen is on a distinguished road
Mac Specs: MacBook Pro 13"(Early 2011) 2.3 Ghz Intel Core i5 Mac OS X 10.8.2

Hexen is offline
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.
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Ottawa
Posts: 17,099
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
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
Mac-Forums Investigates MacKeeper - Confused about MacKeeper? Take a look at this review.
QUOTE Thanks
Hexen

 
Hexen's Avatar
 
Member Since: Sep 25, 2011
Location: San Antonio, TX
Posts: 52
Hexen is on a distinguished road
Mac Specs: MacBook Pro 13"(Early 2011) 2.3 Ghz Intel Core i5 Mac OS X 10.8.2

Hexen is offline
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.
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Ottawa
Posts: 17,099
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
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
Mac-Forums Investigates MacKeeper - Confused about MacKeeper? Take a look at this review.
QUOTE Thanks
Hexen

 
Hexen's Avatar
 
Member Since: Sep 25, 2011
Location: San Antonio, TX
Posts: 52
Hexen is on a distinguished road
Mac Specs: MacBook Pro 13"(Early 2011) 2.3 Ghz Intel Core i5 Mac OS X 10.8.2

Hexen is offline
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.
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Ottawa
Posts: 17,099
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
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
Mac-Forums Investigates MacKeeper - Confused about MacKeeper? Take a look at this review.
QUOTE Thanks
Hexen

 
Hexen's Avatar
 
Member Since: Sep 25, 2011
Location: San Antonio, TX
Posts: 52
Hexen is on a distinguished road
Mac Specs: MacBook Pro 13"(Early 2011) 2.3 Ghz Intel Core i5 Mac OS X 10.8.2

Hexen is offline
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.
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Ottawa
Posts: 17,099
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
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
Mac-Forums Investigates MacKeeper - Confused about MacKeeper? Take a look at this review.
QUOTE Thanks

Post Reply New Thread Subscribe


« opening emails | invoice template »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Why we appreciate grammar here at Mac Forums! BlueMac Community Suggestions and Feedback 55 12-11-2012 01:12 PM
Working with text boxes in MS Office for Mac 2011 eebelz OS X - Apps and Games 0 08-17-2011 06:47 PM
strange, erratic behavior... nuno1959 OS X - Operating System 11 05-05-2010 08:56 PM
text reflow problems from Quark 4.1 to Quark 6.5 plevault13 Running Windows (or anything else) on your Mac 2 09-30-2005 02:59 PM
text reflow problems from Quark 4.1 to Quark 6.5 plevault13 OS X - Apps and Games 0 09-30-2005 01:57 PM

All times are GMT -4. The time now is 03:22 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?