Programming Help-- C++ (g++) compile error

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
Thomas_Bates
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 30
Joined: Thu May 27, 2010 11:34 pm
Current Project: Project CERBERUS (linux only)
Favorite Gaming Platforms: Xbox 360
Programming Language of Choice: C++
Location: Flora, IL
Contact:

Programming Help-- C++ (g++) compile error

Post by Thomas_Bates »

Alright, so I'm a very new programmer, and the following is what I've produced with a bit of Eric's help:

Code: Select all

// Star Trek Captain's Log Program
// by Thomas Bates III
// Hosted by Opticon Studios

#include <iostream>
#include <ctime>
#include <cstdlib>
#include <fstream>
using namespace std;

int main()
{
	ofstream CaptainLog;
	CaptainLog.open ("CptLog.txt", ios::in);
	srand(time(NULL));
	int randnum1 = rand() % 2250 + 99999;
	int randnum2 = rand() % 1 + 0;
	int randnum3;
	
	if (randnum2 == 1) randnum3 = rand() % 2 + 0;
	
	else randnum3 = rand() % 9 + 0;
	
	cout << "Captain's Log, Stardate" << randnum1 << "." << randnum2 << randnum3;
	cout << "\n";
	CaptainLog.close();
	
	return 0;
	
}
When I try to compile, the first time it seemed to work; but I'm now getting the same error on compile, and program start. I believe this is a g++ error, and I did not see it on 9.10:
thomas@thomas-desktop:~/Desktop/CaptainLog$ g++ -o cptlog.cpp CptLog
CptLog: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crt1.o:(.text+0x0): first defined here
CptLog:(.rodata+0x0): multiple definition of `_fp_hw'
/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crt1.o:(.rodata+0x0): first defined here
CptLog: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crti.o:(.fini+0x0): first defined here
CptLog:(.rodata+0x4): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crt1.o:(.rodata.cst4+0x0): first defined here
CptLog: In function `__data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crt1.o:(.data+0x0): first defined here
CptLog: In function `__data_start':
(.data+0x4): multiple definition of `__dso_handle'
/usr/lib/gcc/i486-linux-gnu/4.4.3/crtbegin.o:(.data+0x0): first defined here
CptLog: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crti.o:(.init+0x0): first defined here
/usr/lib/gcc/i486-linux-gnu/4.4.3/crtend.o:(.dtors+0x0): multiple definition of `__DTOR_END__'
CptLog:(.dtors+0x4): first defined here
/usr/bin/ld: warning: Cannot create .eh_frame_hdr section, --eh-frame-hdr ignored.
/usr/bin/ld: error in CptLog(.eh_frame); no .eh_frame_hdr table will be created.
collect2: ld returned 1 exit status
thomas@thomas-desktop:~/Desktop/CaptainLog$
I've no idea what any of this means, is anyone able to help?
Image
Image
User avatar
Thomas_Bates
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 30
Joined: Thu May 27, 2010 11:34 pm
Current Project: Project CERBERUS (linux only)
Favorite Gaming Platforms: Xbox 360
Programming Language of Choice: C++
Location: Flora, IL
Contact:

Re: Programming Help-- C++ (g++) compile error

Post by Thomas_Bates »

I used the wrong compile command, and started the program with the wrong command, idiot mistakes on my part.
Image
Image
User avatar
short
ES Beta Backer
ES Beta Backer
Posts: 548
Joined: Thu Apr 30, 2009 2:22 am
Current Project: c++, c
Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
Programming Language of Choice: c, c++
Location: Oregon, US

Re: Programming Help-- C++ (g++) compile error

Post by short »

lol, I like it. Pulling random stardates of ones ass haha.
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: Programming Help-- C++ (g++) compile error

Post by eatcomics »

That's just how he roles :D but change to solved plz
Image
Live-Dimension
Chaos Rift Junior
Chaos Rift Junior
Posts: 345
Joined: Tue Jan 12, 2010 7:23 pm
Favorite Gaming Platforms: PC - Windows 7
Programming Language of Choice: c++;haxe
Contact:

Re: Programming Help-- C++ (g++) compile error

Post by Live-Dimension »

short wrote:lol, I like it. Pulling random stardates of ones ass haha.
Sadly, the stardates on the shows are actually randomly generated too.
Image
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: Programming Help-- C++ (g++) compile error

Post by Ginto8 »

Live-Dimension wrote:
short wrote:lol, I like it. Pulling random stardates of ones ass haha.
Sadly, the stardates on the shows are actually randomly generated too.
Srsly? that really is sad.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Live-Dimension
Chaos Rift Junior
Chaos Rift Junior
Posts: 345
Joined: Tue Jan 12, 2010 7:23 pm
Favorite Gaming Platforms: PC - Windows 7
Programming Language of Choice: c++;haxe
Contact:

Re: Programming Help-- C++ (g++) compile error

Post by Live-Dimension »

Well, if you've ever watched TOS, you'll know a lot of stuff doesn't fit the rest of the ST universe. A lot of stuff was scrapped for TNG and Enterprize, but more wasn't. Naturally, the stardates also come from TOS, which was randomly generated back then.
Image
Post Reply