There are three ways to solve this:
Simply remove the
#include
line fromtest1.cpp
. Since you are not calling that function, you don't need to include it anyway. Thepragma startup
should take care that the function is called and it will be available because VC will link it.Rename
test2.cpp
totest2.h
and include that one intest1.cpp
. This would be not a best practice though, because functions are normally not supposed to be in header files, even though it is allowed by the compiler.You can place the function from
test2.cpp
directly intotest1.cpp
, as you don't really need it anyway.
To answer your comment - normally you put functions into .c/.cpp
files and declarations, prototypes, definitions, macros etc. into the .h
files. This is not dictated by the compiler though, but good coding practices help to avoid such problems as you posted in your question.