LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Not understanding a question including cpp files (https://www.linuxquestions.org/questions/linux-newbie-8/not-understanding-a-question-including-cpp-files-4175619418/)

goofygoober 12-11-2017 09:48 PM

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?

rhubarbdog 12-11-2017 11:31 PM

g++ main.cpp -omain

goofygoober 12-11-2017 11:34 PM

Quote:

Originally Posted by rhubarbdog (Post 5792171)
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?

rhubarbdog 12-11-2017 11:36 PM

type
Code:

man g++
that will answer all of your questions

AnanthaP 12-11-2017 11:36 PM

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

goofygoober 12-11-2017 11:59 PM

Quote:

Originally Posted by AnanthaP (Post 5792175)
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?

grail 12-12-2017 12:17 AM

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

http://lmgtfy.com/?q=c%2B%2B98

goofygoober 12-12-2017 12:22 AM

Quote:

Originally Posted by grail (Post 5792191)

Thanks for the help

rtmistler 12-12-2017 05:25 AM

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


All times are GMT -5. The time now is 07:29 AM.