I'm working on a payroll program that uses OOP features. I'm aiming to read employee data from a text file and output net pay. I got an error message that I copied below and I need help interpreting it. I don't want a solution, I'm just looking for a hint on what top do next.
int main ()
{
ifstream myFile;
myFile.open("input.txt");
if (myFile.fail())
{
cout <<"File not found!"<< endl;
}
else
{
int count = 0;
Payroll p;
while (!myFile.eof()) {
string foo;
switch (count) {
case 0:
p.set_name(foo);
break;
case 1:
p.set_ID(stoi(foo));
break;
case 2:
p.set_hoursWorked(stod(foo));
break;
case 3:
p.set_wages(stod(foo));
break;
This looks like makefile/project settings problems, not code problems.
Maybe post your make-file, or double check it for issues, or try just a simple command line compile instead since it looks smallish?
It could be you targeted the wrong OS/CPU/Platform in there somewhere, but that could also just be triggered from a different issue.
[code][code][code]# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.13
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake
# The command to remove a file.
RM = /Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/username/CLionProjects/OOPC++Class/PayrollProgram
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/username/CLionProjects/OOPC++Class/PayrollProgram/cmake-build-debug
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /Users/username/CLionProjects/OOPC++Class/PayrollProgram/cmake-build-debug/CMakeFiles /Users/usernamet/CLionProjects/OOPC++Class/PayrollProgram/cmake-build-debug/CMakeFiles/progress.marks
$(MAKE) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /Users/username/CLionProjects/OOPC++Class/PayrollProgram/cmake-build-debug/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
$(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
depend:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
#=============================================================================
# Target rules for targets named PayrollProgram
# Build rule for target.
PayrollProgram: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 PayrollProgram
.PHONY : PayrollProgram
# fast build rule for target.
PayrollProgram/fast:
$(MAKE) -f CMakeFiles/PayrollProgram.dir/build.make CMakeFiles/PayrollProgram.dir/build
.PHONY : PayrollProgram/fast
main.o: main.cpp.o
.PHONY : main.o
# target to build an object file
main.cpp.o:
$(MAKE) -f CMakeFiles/PayrollProgram.dir/build.make CMakeFiles/PayrollProgram.dir/main.cpp.o
.PHONY : main.cpp.o
main.i: main.cpp.i
.PHONY : main.i
# target to preprocess a source file
main.cpp.i:
$(MAKE) -f CMakeFiles/PayrollProgram.dir/build.make CMakeFiles/PayrollProgram.dir/main.cpp.i
.PHONY : main.cpp.i
main.s: main.cpp.s
.PHONY : main.s
# target to generate assembly for a file
main.cpp.s:
$(MAKE) -f CMakeFiles/PayrollProgram.dir/build.make CMakeFiles/PayrollProgram.dir/main.cpp.s
.PHONY : main.cpp.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... rebuild_cache"
@echo "... edit_cache"
@echo "... PayrollProgram"
@echo "... main.o"
@echo "... main.i"
@echo "... main.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_