News:

Facebook killed the radio star. And by radio star, I mean the premise of distributed forums around the internet. And that got got by Instagram/SnapChat. And that got got by TikTok. Where the fuck is the internet we once knew?

Main Menu

G++

Started by AntiVirus, August 30, 2006, 04:23:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AntiVirus

I am doing it at home. :P

I am just doing what my professor told me to do.  No need to argue, he probably has it set up like that because of the way the files are accepted or something to that nature.
The once grove of splendor,
Aforetime crowned by lilac and lily,
Lay now forevermore slender;
And all winds that liven
Silhouette a lone existence;
A leafless oak grasping at eternity.


"They say that I must learn to kill before I can feel safe, but I rather kill myself then turn into their slave."
- The Rasmus

iago

Quote from: AntiVirus on August 31, 2006, 02:27:59 PM
I am doing it at home. :P

I am just doing what my professor told me to do.  No need to argue, he probably has it set up like that because of the way the files are accepted or something to that nature.

No, he's likely doing it because you're new to it and he doesn't want to confuse you, so the "do it exactly like this"-style of thing is more useful.  Once you do it for awhile, you should start to figure out what the different flags do, why you're doing it that way, etc.  But all in time..

AntiVirus

Yes.. All in time.
The once grove of splendor,
Aforetime crowned by lilac and lily,
Lay now forevermore slender;
And all winds that liven
Silhouette a lone existence;
A leafless oak grasping at eternity.


"They say that I must learn to kill before I can feel safe, but I rather kill myself then turn into their slave."
- The Rasmus

MyndFyre

Quote from: AntiVirus on August 30, 2006, 04:42:31 PM
Hrmmm.. Now I feel dumb, but how do I open a .tar file?  And does G++ have an IDE version?  Does any of that make sense?

I feel so stupid. :(

WinZip will open a .tar file as well as .tar.gz and I believe .tar.bz2 files.
Quote from: Joe on January 23, 2011, 11:47:54 PM
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Quote from: Rule on May 26, 2009, 02:02:12 PMOur species really annoys me.

AntiVirus

Alright, cool.  That'll help me in the future. ^^

Danke, Myndfyre.
The once grove of splendor,
Aforetime crowned by lilac and lily,
Lay now forevermore slender;
And all winds that liven
Silhouette a lone existence;
A leafless oak grasping at eternity.


"They say that I must learn to kill before I can feel safe, but I rather kill myself then turn into their slave."
- The Rasmus

Sidoh

Just use WinRar. :-\

iago

Quote from: MyndFyrex86] link=topic=7208.msg89985#msg89985 date=1157135024]
Quote from: AntiVirus on August 30, 2006, 04:42:31 PM
Hrmmm.. Now I feel dumb, but how do I open a .tar file?  And does G++ have an IDE version?  Does any of that make sense?

I feel so stupid. :(

WinZip will open a .tar file as well as .tar.gz and I believe .tar.bz2 files.

Last time I checked, WinZip didn't auto-associate with .tar files, so I just assumed it didn't recognize them.  Maybe that was a mistake. 

Sidoh

I've never opened a bzip2 or gzip file with winzip, so I wouldn't have guessed that either.  I like WinRar quite a bit more anyway.

Rule

#23
re: long "g++ command"...

Make a C/C++ program to do it for you :)

Something like...

clink.c

#include <stdlib.h>
#include <stdio.h>

void usage();

int main(int argc, char *argv[])
{
  char *flags = "-W -Wall -s -pedantic-errors";
  char compilecommand[150]="\0";

  if (argc != 3)  usage();
 
  else
  {
    snprintf(compilecommand, 149, "g++ %s %s -o %s", flags, argv[1], argv[2]);
    system(compilecommand);
  }

  return 0;
}

void usage()
{
  fprintf(stderr, "Usage: ./clink [source file] [desired name of executable]\n");
  fprintf(stderr, "Example: ./clink testprog.c testworked\n");
  fprintf(stderr, "Warning: If the combined lengths of the source file and executable are too long,
           compilation and linking will not be successful\n");



Where I am (today), I don't have easy access to a C compiler or the time to access one.  So, that code might have bugs (I wrote it in 90 seconds, and I didn't test it)!  If so, treat it as a debugging exercise, but I hope it's bug free and makes your life easier. :)

Of course, writing a makefile would ordinarily make more sense, but this is a good way to practice C.

Edit: To compile clink.c, try something like

gcc -ansi -pedantic -Wall clink.c -o clink


To give yourself permission to execute clink,

chmod u+x clink


Also, you're lucky to be learning C++ and not Java as a first language!

Newby

Just write a really simple shell script program to do it for you. I mean, that's nice for practicing his C and all, but he'll have plenty of time to learn C. :)

Quotenewby@impaler:~/programming$ cat test.c
#include <stdio.h>

int main()
{
        printf("Hello, world!\n");
        return 0;
}
newby@impaler:~/programming$ ./clink.sh test.c outputfile
newby@impaler:~/programming$ ./outputfile
Hello, world!

newby@impaler:~/programming$ cat clink.sh
#!/bin/sh

FLAGS='-W -Wall -s -pedantic-errors'

if [ $# -ne 2 ]; then
        echo 1>&2 "Usage: $0 [source file] [desired executable of name]"
        echo 1>&2 "Example: ./$0 testprog.c testworked"
        echo 1>&2 "Warning: If the combined lengths of the source file and executable are too long, compilation and linking will not be successful"
else
        gcc $FLAGS $1 -o $2
fi
- Newby
http://www.x86labs.org

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote from: Rule on June 30, 2008, 01:13:20 PM
Quote from: CrAz3D on June 30, 2008, 10:38:22 AM
I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Explicit

I think you guys may be over-complicating things, at least for now.
QuoteLike all things in life, pumping is just a primitive, degenerate form of bending.

QuoteHey, I don't tell you how to tell me what to do, so don't tell me how to do what you tell me to do! ... Bender knows when to use finesse.

[13:41:45]<@Fapiko> Why is TehUser asking for wang pictures?
[13:42:03]<@TehUser> I wasn't asking for wang pictures, I was looking at them.
[13:47:40]<@TehUser> Mine's fairly short.

Ender

Not really. It's a good practice in programming to automate the building process. Although, all of you should keep in mind that he's on Windows (or at least I thought he was!)

AntiVirus

#27
If you are talking about me, then yes, I am on Windows. :P

I don't have *nix on my laptop yet, but I do have to telnet over to a UNIX server to submit my homework and compile my program.
The once grove of splendor,
Aforetime crowned by lilac and lily,
Lay now forevermore slender;
And all winds that liven
Silhouette a lone existence;
A leafless oak grasping at eternity.


"They say that I must learn to kill before I can feel safe, but I rather kill myself then turn into their slave."
- The Rasmus

Sidoh

... telnet?  surely you mean ssh? :(

Rule

It could be telnet :P.  Makes me sentimental for a time that has long passed. :'(