Ich habe ein Programm in C++ das ich als statische Library bereitstellen möchte.
#include <iostream>
using namespace std;
void sayHello()
{
cout << "Hello world\n";
}
Wenn ich versuche diese Datei zu kompilieren bekomme ich diesen Fehler.
C:\jail-src-main>g++ mylib.cpp -o mylib.o
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
C:\jail-src-main>
Eine Bibliothek benötigt doch keine Main Methode oder?