user14279931
user14279931

Reputation: 43

Linker cant find .cpp implementation of a header file (MSVC)

I'm trying to build a project with the MSVC compiler (cl.exe), the command is

start /b /wait "" "cl.exe" %build_options% %compile_flags% ..\src\win32_main.cpp /link /LIBPATH:..\src\ %link_flags% /out:%application_name%

I have set LIBPATH to where the cpp implementations to my headers are but all I get is an unresolved external. Note, I have no problem running my project without cpp files (meaning everything being inside a header, included in my main and worked through there, the problem is that the linker can't find the implementation of .h files).

Any help would be appreciated, thanks! my files are structured like so

Upvotes: 0

Views: 451

Answers (1)

MSalters
MSalters

Reputation: 180020

The direct problem that you have is that you need to link *.obj files, or possibly *.lib files built from those .obj files, but definitely not .cpp files.

I suggest that you stick with Visual Studio. The root cause of your problem is that you're reinventing the wheel. The MSVC compiler is designed to be called by a build environment.

Upvotes: 1

Related Questions