I’m a beginner creating a clock project with C++ in Visual Studio. I created a header file, a cpp file for function definitions, and a main file. I declared the function names in the header file and used the format suggested by VS for the definitions in the cpp file.
However, after adding definitions there’s a green squiggly line under the String function declarations in the header file saying “Function definition for ‘stringFunctionName’ not found” when I hover over it. This is only for the string functions.
enter image description here enter image description here enter image description hereenter image description here
How can this be fixed? I’m not able to pass any arguments into the functions within the main file. Please help!!
Tried looking everywhere for a fix but couldn’t find.
Don’t post images of text. Copy-paste text as text.
Also please edit your question to show us a minimal reproducible example.
On line 14 of
Clock.h
you declared a functionstd::string nCharString();
which takes no arguments but you tried to call it withcout << nCharString(5);
which passes 1 argument5
to a function that takes no arguments. You can’t pass the 5 to a function that has no arguments. Maybe your declaration inClock.h
was wrong and you meant it to bestd::string nCharString( char someValue);