Rather you seemed to think it worthy of mention; if you mention it, the information is worthless unless we can access it. If it was not relevant to teh question, don't mention it at all.
The point was that any advice given on the site may have been the cause of your problem, and we would have been able to see where you were coming from. Also you may get useful opinion on the quality of the site - there's plenty of bad information out there. Additionally it may be a useful resource for anyone else on the forum.
You appear to be attempting to compile a file called main rather than main.cpp. I am not sure how that would have happened, but assuming that a file main.cpp exists, remove the main from your project and add main.cpp.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks a lot Clifford. The problem appears to have been from when I renamed the Untitled4 file in my project to main. Clearly I needed to add the cpp extension.
I would also like to ask another question if I may.
I have been learning the Windows API from a website and I entered the following code:
> I have been learning the Windows API from a website
Always a good idea to include a link.
> it also shows a DOS window. How do I hide the DOS window?
In the project options dialog, specify that it is a Win32 GUI app. (this will add -mwindows to the linker command line). If you used the Win32 project template it should be set by default.
Note that having the console window available is sometimes helpful; you can ise if to uotput debug to stdout with simple printf calls for example. I have also used it is a command line for GUI apps, crude but simple, and it 'magically' includes features such as command history with no programming!
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Whenever I attempt to compile any projects in Dev-C++ 4.9.9.2 I get the following error:
Circular main <- main.o dependency dropped.
C:\mycstuff\HelloWorld\Makefile.win [Build Error] [HelloWorld.exe] Error 1
Compile Log:
Compiler: Default compiler
Building Makefile: "C:\mycstuff\HelloWorld\Makefile.win"
Executing make...
make.exe -f "C:\mycstuff\HelloWorld\Makefile.win" all
make.exe: Circular main <- main.o dependency dropped.
g++.exe -c main -o main.o -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"
g++.exe: main: linker input file unused because linking not done
g++.exe main.o -o "HelloWorld.exe" -L"C:/Dev-Cpp/lib"
g++.exe: main.o: No such file or directory
g++.exe: no input files
make.exe: *** [HelloWorld.exe] Error 1
Execution terminated
-DrMoo
> since you seem so interested.
Rather you seemed to think it worthy of mention; if you mention it, the information is worthless unless we can access it. If it was not relevant to teh question, don't mention it at all.
The point was that any advice given on the site may have been the cause of your problem, and we would have been able to see where you were coming from. Also you may get useful opinion on the quality of the site - there's plenty of bad information out there. Additionally it may be a useful resource for anyone else on the forum.
This forum is pretty dumb about URLs and included the ',' in the address rendering it broken. http://www.toymaker.info/Games/html/windows_api.html
I'm running Windows XP by the way.
You appear to be attempting to compile a file called main rather than main.cpp. I am not sure how that would have happened, but assuming that a file main.cpp exists, remove the main from your project and add main.cpp.
Clifford
To clarif;, this part of the log:
g++.exe -c main -o main.o [...]
should read:
g++.exe -c main.cpp -o main.o [...]
Clifford
Thanks a lot Clifford. The problem appears to have been from when I renamed the Untitled4 file in my project to main. Clearly I needed to add the cpp extension.
I would also like to ask another question if I may.
I have been learning the Windows API from a website and I entered the following code:
include <windows.h>
define WIN32_LEAN_AND_MEAN
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd,message,wParam,lParam);
break;
}
return 0;
}
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
WNDCLASSEX wcex;
wcex.cbSize=sizeof(WNDCLASSEX);
wcex.style=CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc=(WNDPROC)WndProc;
wcex.cbClsExtra=0;
wcex.cbWndExtra=0;
wcex.hInstance=hInstance;
wcex.hIcon=0;
wcex.hCursor=LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName=0;
wcex.lpszClassName="MyWindowClass";
wcex.hIconSm=0;
RegisterClassEx(&wcex);
HWND hWnd = CreateWindow("MyWindowClass","My Window",WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int)msg.wParam;
}
and after compiling, it shows an empty window (like it should) but it also shows a DOS window. How do I hide the DOS window?
> I have been learning the Windows API from a website
Always a good idea to include a link.
> it also shows a DOS window. How do I hide the DOS window?
In the project options dialog, specify that it is a Win32 GUI app. (this will add -mwindows to the linker command line). If you used the Win32 project template it should be set by default.
Note that having the console window available is sometimes helpful; you can ise if to uotput debug to stdout with simple printf calls for example. I have also used it is a command line for GUI apps, crude but simple, and it 'magically' includes features such as command history with no programming!
Clifford
Thanks again Clifford. The website was http://www.toymaker.info/Games/html/windows_api.html, since you seem so interested.