Recently started trying to create DLLs in C++ and have been trying to create a generic user prompt class for command line input. When I try to compile the code I get the following error in the .cpp:
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libmingw32.a(main.o):(.text.startup+0xa7): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
make.exe": *** [userPrompt] Error 1
Doing some reading on the error led me to believe that this occurs when there's no main function in the file -- If this is the case how do I avoid this when trying to make a .cpp file for the purpose of putting it in a library?
My current compiler is MinGW and my current IDE is NetBeans.
EDIT: As requested, full command line logs for the compile Additionally, undefined reference to `WinMain@16' (As linked in the answer posted as a duplicate) implies in the answer that a main or WinMain is required somewhere in a .cpp file for it to compile, a part of the question asked above (And I'm sorry if this was unclear) is if that is actually the case, and if it is not how do I circumvent this restriction?
g++ userPrompt.cpp -o userPrompt
userPrompt.cpp:33:54: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
const string strCommands[2] = {"HELP", "QUIT"}; // Array of all valid commands.
^
userPrompt.cpp:34:92: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
const string strHelpText[2] = {"to re-list these commands.", "to exit this prompt."}; // Parallel array of help texts for valid commands.
^
userPrompt.cpp:38:17: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
"==================================================\n";
^
userPrompt.cpp:33:54: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
const string strCommands[2] = {"HELP", "QUIT"}; // Array of all valid commands.
^
userPrompt.cpp:34:92: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
const string strHelpText[2] = {"to re-list these commands.", "to exit this prompt."}; // Parallel array of help texts for valid commands.
^
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libmingw32.a(main.o):(.text.startup+0xa7): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
make.exe": *** [userPrompt] Error 1
BUILD FAILED (exit value 2, total time: 504ms)