LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-11-2017, 09:48 PM   #1
goofygoober
Member
 
Registered: Nov 2017
Posts: 37

Rep: Reputation: Disabled
Not understanding a question including cpp files


I've been given this question in an assignment and i'm not exactly sure what to do with it. This is how it is written:

Write a command that will generate an executable file named
main
from the C++14 source code file
main.cpp

I'm mostly confused because I don't have any files that come with this assignment, just a few questions and this is the first one.

Any ideas?
 
Old 12-11-2017, 11:31 PM   #2
rhubarbdog
Member
 
Registered: Apr 2015
Location: Yorkshire, England
Distribution: Linux Mint
Posts: 145

Rep: Reputation: Disabled
g++ main.cpp -omain
 
Old 12-11-2017, 11:34 PM   #3
goofygoober
Member
 
Registered: Nov 2017
Posts: 37

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rhubarbdog View Post
g++ main.cpp -omain
So g++ compiles main.cpp into a file named main? What does the -o option do?
Also, I’ve got the same question but this time it states c++98 instead of c++14, what is the difference?
 
Old 12-11-2017, 11:36 PM   #4
rhubarbdog
Member
 
Registered: Apr 2015
Location: Yorkshire, England
Distribution: Linux Mint
Posts: 145

Rep: Reputation: Disabled
type
Code:
man g++
that will answer all of your questions
 
Old 12-11-2017, 11:36 PM   #5
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
The assignment giver (a McTeacher probably) hasn't given you any file named main.cpp. So write your own small main.cpp (say to print HELLO WORLD. Then use your main.cpp to the command (probably ld to create the executable file called as main.

OK
 
1 members found this post helpful.
Old 12-11-2017, 11:59 PM   #6
goofygoober
Member
 
Registered: Nov 2017
Posts: 37

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by AnanthaP View Post
The assignment giver (a McTeacher probably) hasn't given you any file named main.cpp. So write your own small main.cpp (say to print HELLO WORLD. Then use your main.cpp to the command (probably ld to create the executable file called as main.

OK
Okay, do you know why 1 question asks for c++14 and one asks for c++98?
 
Old 12-12-2017, 12:17 AM   #7
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,005

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
http://lmgtfy.com/?q=c%2B%2B14

http://lmgtfy.com/?q=c%2B%2B98
 
Old 12-12-2017, 12:22 AM   #8
goofygoober
Member
 
Registered: Nov 2017
Posts: 37

Original Poster
Rep: Reputation: Disabled
Thanks for the help
 
Old 12-12-2017, 05:25 AM   #9
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,879
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
goofygoober,

Please be aware that many of your questions show a failure to have read any basics about these topics. LQ is not a Wikipedia page. Please perform some searches for information, prior to asking. If you have any questions about how to use LQ or pose questions, please review the LQ Welcome Link
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Is it ok to sync all files including config files from one PC to another PC? linustalman Linux - Networking 15 07-28-2014 03:03 PM
[SOLVED] C++: Not #including files? ryan858 Programming 15 06-20-2010 04:23 PM
compile cpp code including iostream ufmale Programming 1 09-13-2008 01:30 AM
Including header files and source files for classes Feenix Programming 8 09-28-2005 10:53 AM
gcc header files and cpp files? EchO Linux - Software 3 03-01-2005 01:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration