- main.cpp
#include <iostream>
#include "log.hpp"
int main()
{
InitLog();
Log("Hello World");
std::cin.get();
}
- Log.cpp
#include <iostream>
#include "log.hpp"
void InitLog()
{
Log("Initialize Log");
}
void Log(const char *message)
{
std::cout << message << std::endl;
}
- log.hpp
#pragma once
void Log(const char *message);
void InitLog();
The errors are:
Log.cpp - undefined reference to `WinMain' collect2.exe: error: ld returned 1 exit status
main.cpp - c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\91813\AppData\Local\Temp\cckelbDG.o:main.cpp:(.text+0xe): undefined reference to
InitLog()' c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\91813\AppData\Local\Temp\cckelbDG.o:main.cpp:(.text+0x1d): undefined reference to
Log(char const*)' collect2.exe: error: ld returned 1 exit status