I have some C++ code that is working programmatcially but will not populate the
ID: 3886798 • Letter: I
Question
I have some C++ code that is working programmatcially but will not populate the output file when I run it in linux through a script. I am getting the following when I Compile the script:
rm: cannot remove '*.o': No such file or directory
rm: cannot remove 'Aprog': No such file or directory
g++ -O3 -Wall -std=c++11 -c main.cc
main.cc: In function ‘int main()’:
main.cc:129:19: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
system("pause");
^
g++ -O3 -Wall -std=c++11 -c ../../Utilities/scanner.cc
g++ -O3 -Wall -std=c++11 -c ../../Utilities/scanline.cc
g++ -O3 -Wall -std=c++11 -c ../../Utilities/utils.cc
g++ -O3 -Wall -std=c++11 -o Aprog main.o scanner.o scanline.o utils.o
Return from 'testdirectory' directory
COMPILING COMPLETE
Explanation / Answer
1)
rm: cannot remove '*.o': No such file or directory
rm: cannot remove 'Aprog': No such file or directory:
this error is coming because script is trying to remove all files 'Aprog' and with extension '*.o' but these files are not in directory.
2)
add : 'return 0;' at last of main function to solve : warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result]