Dark Bit Factory & Gravity
PROGRAMMING => C / C++ /C# => Topic started by: xteraco on July 05, 2006
-
ok, heres a good tutorial that i think belongs in the c++ section here... basically its a extremely simple program that shows how to make a dll, and then make an exe that can read from it... pretty simple :)
-enjoy
-
Cheers dude :) + Karma!
-
I've tryed to learn c++ before but gave up since I diddn't know anyone hwo knew the language and now i tryed this...
I get the error when tyying to compile it
[Linker error] undefined reference to `WinMain@16'
Edit:
I tryed some other code and got the same error
Edit:
This may help
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Documents and Settings\david1.DAVID\Desktop\paul\blitz userlib tests\dono\c++\tutirial\dll\dll.cpp" -o "C:\Documents and Settings\david1.DAVID\Desktop\paul\blitz userlib tests\dono\c++\tutirial\dll\dll.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:\Dev-Cpp\lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
Execution terminated
-
Depends what kind of program you're trying to write. If you're writing a normal command prompt program, the execution of your code begins with a function called main(). If you're writing a Windows program then your code begins with WinMain(). And if you're writing a DLL, your code gets called at DllMain().
So, C and C++ command line programs look like this
int main(void)
{
//your code goes here
return 0;
}
and a Windows app looks like this
#include <windows.h>
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
//your code goes here
return 0;
}
I think the problem is you've got your dev C settings wrong, and you're trying to build a command line program as a Windows program, and it thinks that WinMain() is missing.
Jim