My professor has pointed out that this isn't normal, but I have been struggling to fix the error.
I am using VSCode as my IDE, and have installed the C/C++ extensions. I haven't been able to find anyone else describing this error, and my professor has been unable to help me find the cause, and has told me to ask a coding community to look for help.
I fear that something may be corrupted with my linker, as that was a concern my professor had.
I am able to run my driver with all of these include statements:
#include "unsorted.h"
#include "DateType.h"
#include "PersonType.h"
#include "StudentType.h"
#include <iostream>
#include "DateType.cpp"
#include "PersonType.cpp"
#include "StudentType.cpp"
#include "unsorted.cpp"
using namespace std;
but if I comment out the .cpp
files, the driver will fail to compile. My professor says I should only be including the .h
files and not the .cpp
files, but that causes errors.
I tried to comment out the .cpp
files, but the code won't compile like that, even though it should only require the header file.
Why is this happening?
I changed my tasks.json file to include this
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "C:\\MinGW\\bin\\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${workspaceFolder}\\*.cpp",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
it didn't solve my issue. I am running windows 10, and can't fix this compiler bug. I can't find the source of the problem, and the related link didn't help.