SlideShare a Scribd company logo
1 of 4
Download to read offline
Enid M. Cruz-Colón
COMP 3010-030
HW 1: Compiler Toolchain
Problem 1
(a) The name of the executable program created by the compiler if the programmer does not
specify one is a.out.
(b) To compile a program and rename the executable file with a name other than the default
name, a.out, the command is:
g++ -o <new_name>.out <sourcecode_name>.cpp
Problem 2
The -Wall command line enables error warnings from the compiler when compiling your source
code.
The -c command line compiles a source code into an object file, not yet executable.
With the command g++ -o MyFirstProgram MyFirstSource.o we accomplish to change the
object code into machine code and store it in an executable program.
Problem 3
To change the program for it to greet the user with Hello, I inserted the following line, right
after the int number_of_pods, peas_per_pod, total_peas; line:
cout << “Hellon”;
To change the program for it to output Goodbye at the end, I inserted the following line, right
before the return 0; line:
cout << “Goodbyen”;
Problem 4
When replacing the “*” operator in the computation with a “/” and entering 0 for the number of
peas per pod, the compiler gives the following error: Floating point exception (core dumped). It
gives an error because the program is dividing the number of pods by peas per pod and you cannot
divide by 0.
Problem 5
When replacing the “/” operator in the computation with the “+” operator, the compiler does not
issue any errors, but the program gives a wrong answer.
Problem 6
(a) Error: Extra space between < and iostream.
Message: MyFirstSource.cpp:3:21: fatal error: iostream: No such file or directory
#include < iostream>
(b) Error: Omit < symbol in the #include directive.
Message: MyFirstSource.cpp:3:12: error: #include expects "FILENAME" or
<FILENAME>
#include iostream>
^
MyFirstSource.cpp: In function ‘int main()’:
MyFirstSource.cpp:8:3: error: ‘cout’ was not declared in this scope
cout << "Hellon";
^
MyFirstSource.cpp:11:3: error: ‘cin’ was not declared in this scope
cin >> number_of_pods;
^
(c) Error: Omit int from int main().
Message: MyFirstSource.cpp:5:10: warning: ISO C++ forbids declaration of ‘main’
with no type [-Wreturn-type]
main()
^
(d) Error: Misspell the word main.
Message: /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../lib64/crt1.o: In function
`_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
(e) Error: Omit (.
Message: MyFirstSource.cpp:5:9: error: expected initializer before ‘)’ token
int main)
^
Error: Omit both ( and ).
Message: MyFirstSource.cpp:6:1: warning: extended initializer lists only available
with -std=c++11 or -std=gnu++11
{
^
MyFirstSource.cpp:7:3: error: expected primary-expression before ‘int’
int number_of_pods, peas_per_pod, total_peas;
^
MyFirstSource.cpp:7:3: error: expected ‘}’ before ‘int’
MyFirstSource.cpp:7:3: error: expected ‘,’ or ‘;’ before ‘int’
MyFirstSource.cpp:8:3: error: ‘cout’ does not name a type
cout << "Hellon";
^
MyFirstSource.cpp:9:3: error: ‘cout’ does not name a type
cout << "Press return after entering a number.n";
^
MyFirstSource.cpp:10:3: error: ‘cout’ does not name a type
cout << "Enter the number of pods:n";
^
MyFirstSource.cpp:11:3: error: ‘cin’ does not name a type
cin >> number_of_pods;
^
MyFirstSource.cpp:12:3: error: ‘cout’ does not name a type
cout << "Enter the number of peas in a pod:n";
^
MyFirstSource.cpp:13:3: error: ‘cin’ does not name a type
cin >> peas_per_pod;
^
MyFirstSource.cpp:14:3: error: ‘total_peas’ does not name a type
total_peas = number_of_pods + peas_per_pod;
^
MyFirstSource.cpp:15:3: error: ‘cout’ does not name a type
cout << "If you have ";
^
MyFirstSource.cpp:16:3: error: ‘cout’ does not name a type
cout << number_of_pods;
^
MyFirstSource.cpp:17:3: error: ‘cout’ does not name a type
cout << " pea podsn";
^
MyFirstSource.cpp:18:3: error: ‘cout’ does not name a type
cout << "and ";
^
MyFirstSource.cpp:19:3: error: ‘cout’ does not name a type
cout << peas_per_pod;
^
MyFirstSource.cpp:20:3: error: ‘cout’ does not name a type
cout << " peas in each pod, thenn";
^
MyFirstSource.cpp:21:3: error: ‘cout’ does not name a type
cout << "you have ";
^
MyFirstSource.cpp:22:3: error: ‘cout’ does not name a type
cout << total_peas;
^
MyFirstSource.cpp:23:3: error: ‘cout’ does not name a type
cout << " peas in all the pods.n";
^
MyFirstSource.cpp:24:3: error: ‘cout’ does not name a type
cout << "Goodbyen";
^
MyFirstSource.cpp:25:3: error: expected unqualified-id before ‘return’
return 0;
^
MyFirstSource.cpp:26:1: error: expected declaration before ‘}’ token
}
^
(f) Error: Misspell cin.
Message: MyFirstSource.cpp: In function ‘int main()’:
MyFirstSource.cpp:11:3: error: ‘cn’ was not declared in this scope
cn >> number_of_pods;
^

More Related Content

What's hot

PyCon lightning talk on my Toro module for Tornado
PyCon lightning talk on my Toro module for TornadoPyCon lightning talk on my Toro module for Tornado
PyCon lightning talk on my Toro module for Tornadoemptysquare
 
ZendCon 2017 - Build a Bot Workshop - Async Primer
ZendCon 2017 - Build a Bot Workshop - Async PrimerZendCon 2017 - Build a Bot Workshop - Async Primer
ZendCon 2017 - Build a Bot Workshop - Async PrimerAdam Englander
 
Debugging Your PHP Cake Application
Debugging Your PHP Cake ApplicationDebugging Your PHP Cake Application
Debugging Your PHP Cake ApplicationJose Diaz-Gonzalez
 
Python meetup: coroutines, event loops, and non-blocking I/O
Python meetup: coroutines, event loops, and non-blocking I/OPython meetup: coroutines, event loops, and non-blocking I/O
Python meetup: coroutines, event loops, and non-blocking I/OBuzzcapture
 
C++ Programming - 2nd Study
C++ Programming - 2nd StudyC++ Programming - 2nd Study
C++ Programming - 2nd StudyChris Ohk
 
Python Programming Essentials - M16 - Control Flow Statements and Loops
Python Programming Essentials - M16 - Control Flow Statements and LoopsPython Programming Essentials - M16 - Control Flow Statements and Loops
Python Programming Essentials - M16 - Control Flow Statements and LoopsP3 InfoTech Solutions Pvt. Ltd.
 
Of Harmony and Stinginess: Applicative, Monad, and iterative library design
Of Harmony and Stinginess: Applicative, Monad, and iterative library designOf Harmony and Stinginess: Applicative, Monad, and iterative library design
Of Harmony and Stinginess: Applicative, Monad, and iterative library designjspha
 
C program to write c program without using main function
C program to write c program without using main functionC program to write c program without using main function
C program to write c program without using main functionRumman Ansari
 
Incredible Machine with Pipelines and Generators
Incredible Machine with Pipelines and GeneratorsIncredible Machine with Pipelines and Generators
Incredible Machine with Pipelines and Generatorsdantleech
 
Stop Programming in JavaScript By Luck
Stop Programming in JavaScript By LuckStop Programming in JavaScript By Luck
Stop Programming in JavaScript By Lucksergioafp
 
C++ Programming - 3rd Study
C++ Programming - 3rd StudyC++ Programming - 3rd Study
C++ Programming - 3rd StudyChris Ohk
 
clap: Command line argument parser for Pharo
clap: Command line argument parser for Pharoclap: Command line argument parser for Pharo
clap: Command line argument parser for PharoESUG
 
Basic Programs of C++
Basic Programs of C++Basic Programs of C++
Basic Programs of C++Bharat Kalia
 

What's hot (20)

PyCon lightning talk on my Toro module for Tornado
PyCon lightning talk on my Toro module for TornadoPyCon lightning talk on my Toro module for Tornado
PyCon lightning talk on my Toro module for Tornado
 
ZendCon 2017 - Build a Bot Workshop - Async Primer
ZendCon 2017 - Build a Bot Workshop - Async PrimerZendCon 2017 - Build a Bot Workshop - Async Primer
ZendCon 2017 - Build a Bot Workshop - Async Primer
 
Debugging Your PHP Cake Application
Debugging Your PHP Cake ApplicationDebugging Your PHP Cake Application
Debugging Your PHP Cake Application
 
C to perl binding
C to perl bindingC to perl binding
C to perl binding
 
Python meetup: coroutines, event loops, and non-blocking I/O
Python meetup: coroutines, event loops, and non-blocking I/OPython meetup: coroutines, event loops, and non-blocking I/O
Python meetup: coroutines, event loops, and non-blocking I/O
 
C++ Programming - 2nd Study
C++ Programming - 2nd StudyC++ Programming - 2nd Study
C++ Programming - 2nd Study
 
Cs project
Cs projectCs project
Cs project
 
Python Programming Essentials - M16 - Control Flow Statements and Loops
Python Programming Essentials - M16 - Control Flow Statements and LoopsPython Programming Essentials - M16 - Control Flow Statements and Loops
Python Programming Essentials - M16 - Control Flow Statements and Loops
 
Rcpp11
Rcpp11Rcpp11
Rcpp11
 
Of Harmony and Stinginess: Applicative, Monad, and iterative library design
Of Harmony and Stinginess: Applicative, Monad, and iterative library designOf Harmony and Stinginess: Applicative, Monad, and iterative library design
Of Harmony and Stinginess: Applicative, Monad, and iterative library design
 
Intro to C++
Intro to C++Intro to C++
Intro to C++
 
C program to write c program without using main function
C program to write c program without using main functionC program to write c program without using main function
C program to write c program without using main function
 
Unix
UnixUnix
Unix
 
1 c introduction
1 c introduction1 c introduction
1 c introduction
 
C++ file
C++ fileC++ file
C++ file
 
Incredible Machine with Pipelines and Generators
Incredible Machine with Pipelines and GeneratorsIncredible Machine with Pipelines and Generators
Incredible Machine with Pipelines and Generators
 
Stop Programming in JavaScript By Luck
Stop Programming in JavaScript By LuckStop Programming in JavaScript By Luck
Stop Programming in JavaScript By Luck
 
C++ Programming - 3rd Study
C++ Programming - 3rd StudyC++ Programming - 3rd Study
C++ Programming - 3rd Study
 
clap: Command line argument parser for Pharo
clap: Command line argument parser for Pharoclap: Command line argument parser for Pharo
clap: Command line argument parser for Pharo
 
Basic Programs of C++
Basic Programs of C++Basic Programs of C++
Basic Programs of C++
 

Similar to Compiler Errors in C++ Program

OOPS using C++
OOPS using C++OOPS using C++
OOPS using C++cpjcollege
 
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...bhargavi804095
 
Introduction to cpp
Introduction to cppIntroduction to cpp
Introduction to cppNilesh Dalvi
 
C Programming- Harsh Sharma
C Programming- Harsh SharmaC Programming- Harsh Sharma
C Programming- Harsh SharmaHarsh Sharma
 
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHFC BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHFAbcdR5
 
A function definition num_digits with Cpp programnum_digits.cpp#.pdf
A function definition num_digits with Cpp programnum_digits.cpp#.pdfA function definition num_digits with Cpp programnum_digits.cpp#.pdf
A function definition num_digits with Cpp programnum_digits.cpp#.pdfanand1213
 
c++basics.ppt
c++basics.pptc++basics.ppt
c++basics.pptEPORI
 
Basics Of C++.pptx
Basics Of C++.pptxBasics Of C++.pptx
Basics Of C++.pptxDineshDhuri4
 
Labsheet1 stud
Labsheet1 studLabsheet1 stud
Labsheet1 studrohassanie
 
Chapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory ConceptChapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory ConceptDeepak Singh
 

Similar to Compiler Errors in C++ Program (20)

OOPS using C++
OOPS using C++OOPS using C++
OOPS using C++
 
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
 
Introduction to cpp
Introduction to cppIntroduction to cpp
Introduction to cpp
 
lecture1 pf.pptx
lecture1 pf.pptxlecture1 pf.pptx
lecture1 pf.pptx
 
Labsheet_3
Labsheet_3Labsheet_3
Labsheet_3
 
Labsheet1stud
Labsheet1studLabsheet1stud
Labsheet1stud
 
C Programming- Harsh Sharma
C Programming- Harsh SharmaC Programming- Harsh Sharma
C Programming- Harsh Sharma
 
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHFC BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
 
A function definition num_digits with Cpp programnum_digits.cpp#.pdf
A function definition num_digits with Cpp programnum_digits.cpp#.pdfA function definition num_digits with Cpp programnum_digits.cpp#.pdf
A function definition num_digits with Cpp programnum_digits.cpp#.pdf
 
c++basics.ppt
c++basics.pptc++basics.ppt
c++basics.ppt
 
C++basics
C++basicsC++basics
C++basics
 
C++basics
C++basicsC++basics
C++basics
 
c++basiccs.ppt
c++basiccs.pptc++basiccs.ppt
c++basiccs.ppt
 
c++basics.ppt
c++basics.pptc++basics.ppt
c++basics.ppt
 
c++basics.ppt
c++basics.pptc++basics.ppt
c++basics.ppt
 
Basics Of C++.pptx
Basics Of C++.pptxBasics Of C++.pptx
Basics Of C++.pptx
 
Labsheet1 stud
Labsheet1 studLabsheet1 stud
Labsheet1 stud
 
C++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWAREC++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWARE
 
Oops presentation
Oops presentationOops presentation
Oops presentation
 
Chapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory ConceptChapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory Concept
 

More from enidcruz

Lab7: More Arrays, Strings, Vectors, and Pointers
Lab7: More Arrays, Strings, Vectors, and PointersLab7: More Arrays, Strings, Vectors, and Pointers
Lab7: More Arrays, Strings, Vectors, and Pointersenidcruz
 
Lab6: I/O and Arrays
Lab6: I/O and ArraysLab6: I/O and Arrays
Lab6: I/O and Arraysenidcruz
 
Lab5: Functions 2
Lab5: Functions 2Lab5: Functions 2
Lab5: Functions 2enidcruz
 
Lab4: Functions
Lab4: FunctionsLab4: Functions
Lab4: Functionsenidcruz
 
Lab3: More Flow of Control
Lab3: More Flow of ControlLab3: More Flow of Control
Lab3: More Flow of Controlenidcruz
 
My First Source Code
My First Source CodeMy First Source Code
My First Source Codeenidcruz
 
Comp 3010 Syllabus
Comp 3010 SyllabusComp 3010 Syllabus
Comp 3010 Syllabusenidcruz
 
Foto-ensayo VIEQUES
Foto-ensayo VIEQUESFoto-ensayo VIEQUES
Foto-ensayo VIEQUESenidcruz
 

More from enidcruz (8)

Lab7: More Arrays, Strings, Vectors, and Pointers
Lab7: More Arrays, Strings, Vectors, and PointersLab7: More Arrays, Strings, Vectors, and Pointers
Lab7: More Arrays, Strings, Vectors, and Pointers
 
Lab6: I/O and Arrays
Lab6: I/O and ArraysLab6: I/O and Arrays
Lab6: I/O and Arrays
 
Lab5: Functions 2
Lab5: Functions 2Lab5: Functions 2
Lab5: Functions 2
 
Lab4: Functions
Lab4: FunctionsLab4: Functions
Lab4: Functions
 
Lab3: More Flow of Control
Lab3: More Flow of ControlLab3: More Flow of Control
Lab3: More Flow of Control
 
My First Source Code
My First Source CodeMy First Source Code
My First Source Code
 
Comp 3010 Syllabus
Comp 3010 SyllabusComp 3010 Syllabus
Comp 3010 Syllabus
 
Foto-ensayo VIEQUES
Foto-ensayo VIEQUESFoto-ensayo VIEQUES
Foto-ensayo VIEQUES
 

Recently uploaded

Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoSérgio Sacani
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRDelhi Call girls
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real timeSatoshi NAKAHIRA
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Lokesh Kothari
 
NAVSEA PEO USC - Unmanned & Small Combatants 26Oct23.pdf
NAVSEA PEO USC - Unmanned & Small Combatants 26Oct23.pdfNAVSEA PEO USC - Unmanned & Small Combatants 26Oct23.pdf
NAVSEA PEO USC - Unmanned & Small Combatants 26Oct23.pdfWadeK3
 
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Nistarini College, Purulia (W.B) India
 
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxSOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxkessiyaTpeter
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptxanandsmhk
 
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...jana861314
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSarthak Sekhar Mondal
 
Analytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdfAnalytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdfSwapnil Therkar
 
Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsAArockiyaNisha
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)PraveenaKalaiselvan1
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )aarthirajkumar25
 
Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Patrick Diehl
 
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |aasikanpl
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​kaibalyasahoo82800
 

Recently uploaded (20)

Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on Io
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real time
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
 
NAVSEA PEO USC - Unmanned & Small Combatants 26Oct23.pdf
NAVSEA PEO USC - Unmanned & Small Combatants 26Oct23.pdfNAVSEA PEO USC - Unmanned & Small Combatants 26Oct23.pdf
NAVSEA PEO USC - Unmanned & Small Combatants 26Oct23.pdf
 
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...
 
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxSOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
 
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptxUnlocking  the Potential: Deep dive into ocean of Ceramic Magnets.pptx
Unlocking the Potential: Deep dive into ocean of Ceramic Magnets.pptx
 
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
 
Analytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdfAnalytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdf
 
Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based Nanomaterials
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )
 
Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?
 
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
 
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​
 

Compiler Errors in C++ Program

  • 1. Enid M. Cruz-Colón COMP 3010-030 HW 1: Compiler Toolchain Problem 1 (a) The name of the executable program created by the compiler if the programmer does not specify one is a.out. (b) To compile a program and rename the executable file with a name other than the default name, a.out, the command is: g++ -o <new_name>.out <sourcecode_name>.cpp Problem 2 The -Wall command line enables error warnings from the compiler when compiling your source code. The -c command line compiles a source code into an object file, not yet executable. With the command g++ -o MyFirstProgram MyFirstSource.o we accomplish to change the object code into machine code and store it in an executable program. Problem 3 To change the program for it to greet the user with Hello, I inserted the following line, right after the int number_of_pods, peas_per_pod, total_peas; line: cout << “Hellon”; To change the program for it to output Goodbye at the end, I inserted the following line, right before the return 0; line: cout << “Goodbyen”; Problem 4 When replacing the “*” operator in the computation with a “/” and entering 0 for the number of peas per pod, the compiler gives the following error: Floating point exception (core dumped). It gives an error because the program is dividing the number of pods by peas per pod and you cannot divide by 0. Problem 5 When replacing the “/” operator in the computation with the “+” operator, the compiler does not issue any errors, but the program gives a wrong answer. Problem 6 (a) Error: Extra space between < and iostream. Message: MyFirstSource.cpp:3:21: fatal error: iostream: No such file or directory #include < iostream> (b) Error: Omit < symbol in the #include directive.
  • 2. Message: MyFirstSource.cpp:3:12: error: #include expects "FILENAME" or <FILENAME> #include iostream> ^ MyFirstSource.cpp: In function ‘int main()’: MyFirstSource.cpp:8:3: error: ‘cout’ was not declared in this scope cout << "Hellon"; ^ MyFirstSource.cpp:11:3: error: ‘cin’ was not declared in this scope cin >> number_of_pods; ^ (c) Error: Omit int from int main(). Message: MyFirstSource.cpp:5:10: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] main() ^ (d) Error: Misspell the word main. Message: /usr/lib/gcc/x86_64-redhat-linux/4.9.2/../../../../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status (e) Error: Omit (. Message: MyFirstSource.cpp:5:9: error: expected initializer before ‘)’ token int main) ^ Error: Omit both ( and ). Message: MyFirstSource.cpp:6:1: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 { ^ MyFirstSource.cpp:7:3: error: expected primary-expression before ‘int’ int number_of_pods, peas_per_pod, total_peas; ^ MyFirstSource.cpp:7:3: error: expected ‘}’ before ‘int’ MyFirstSource.cpp:7:3: error: expected ‘,’ or ‘;’ before ‘int’ MyFirstSource.cpp:8:3: error: ‘cout’ does not name a type cout << "Hellon"; ^ MyFirstSource.cpp:9:3: error: ‘cout’ does not name a type cout << "Press return after entering a number.n"; ^ MyFirstSource.cpp:10:3: error: ‘cout’ does not name a type cout << "Enter the number of pods:n"; ^
  • 3. MyFirstSource.cpp:11:3: error: ‘cin’ does not name a type cin >> number_of_pods; ^ MyFirstSource.cpp:12:3: error: ‘cout’ does not name a type cout << "Enter the number of peas in a pod:n"; ^ MyFirstSource.cpp:13:3: error: ‘cin’ does not name a type cin >> peas_per_pod; ^ MyFirstSource.cpp:14:3: error: ‘total_peas’ does not name a type total_peas = number_of_pods + peas_per_pod; ^ MyFirstSource.cpp:15:3: error: ‘cout’ does not name a type cout << "If you have "; ^ MyFirstSource.cpp:16:3: error: ‘cout’ does not name a type cout << number_of_pods; ^ MyFirstSource.cpp:17:3: error: ‘cout’ does not name a type cout << " pea podsn"; ^ MyFirstSource.cpp:18:3: error: ‘cout’ does not name a type cout << "and "; ^ MyFirstSource.cpp:19:3: error: ‘cout’ does not name a type cout << peas_per_pod; ^ MyFirstSource.cpp:20:3: error: ‘cout’ does not name a type cout << " peas in each pod, thenn"; ^ MyFirstSource.cpp:21:3: error: ‘cout’ does not name a type cout << "you have "; ^ MyFirstSource.cpp:22:3: error: ‘cout’ does not name a type cout << total_peas; ^ MyFirstSource.cpp:23:3: error: ‘cout’ does not name a type cout << " peas in all the pods.n"; ^ MyFirstSource.cpp:24:3: error: ‘cout’ does not name a type cout << "Goodbyen"; ^ MyFirstSource.cpp:25:3: error: expected unqualified-id before ‘return’ return 0; ^ MyFirstSource.cpp:26:1: error: expected declaration before ‘}’ token } ^
  • 4. (f) Error: Misspell cin. Message: MyFirstSource.cpp: In function ‘int main()’: MyFirstSource.cpp:11:3: error: ‘cn’ was not declared in this scope cn >> number_of_pods; ^