Hi to all.
I have no experience with project.

http://img98.imageshack.us/my.php?image=problemzc7.jpg

How to connect these files in Dev-C++?

Recommended Answers

All 27 Replies

First, create a new project File --> New --> Project
After that, copy the files from the project you posted into the Dev-C++ project you just created then add those files to the project. In the Project tab on the left side of the screen expand the Project1 folder (assuming you named the new project the default name). Right click on that folder name and select Add To Project menu item.

You do not need the makefile that's in the link. So do not attempt to add it to your project.

The second link you posted doesn't work.

First, create a new project File --> New --> Project
After that, copy the files from the project you posted into the Dev-C++ project you just created then add those files to the project. In the Project tab on the left side of the screen expand the Project1 folder (assuming you named the new project the default name). Right click on that folder name and select Add To Project menu item.

You do not need the makefile that's in the link. So do not attempt to add it to your project.

The second link you posted doesn't work.

The second is done.Is it working?
But the First I can only add three type of file rc , c , h .
And i have a several errors.

You don't add the icon files either because the *.rc file will include them.

>>The program is not same as Writer wrote
Your link doesn't work. I can't help you if you don't post the code you wrote.

And this is the files that autor sent me.
And my question is what to do with the files in goal to achieve the exe prgoram like he did.

A peice of humble advice for elite1986.

You may have not known this before but it is considered (very truelly so) a malpractice and a cheap way to increase the no. of posts to post content in multiple posts. You can edit your post during the half an hour period after the time when you posted it. I learned this the harder way by losing my reputation. So I thought that I must inform you.

commented: Good advice. +19
commented: How retarded! -2

From a long time spending.

And why the project have a several mistakes when i put the files ( rc , c, h) into project?


main_one.c

#include <windows.h>

#include "resource.h" 

const char g_szClassName[] = "myWindowClass";

LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
	switch(Message)
	{
		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case ID_FILE_EXIT:
					PostMessage(hwnd, WM_CLOSE, 0, 0);
				break;
				case ID_STUFF_GO:
					MessageBox(hwnd, "You clicked Go!", "Woo!", MB_OK);
				break;
			}
		break;
		case WM_CLOSE:
			DestroyWindow(hwnd);
		break;
		case WM_DESTROY:
			PostQuitMessage(0);
		break;
		default:
			return DefWindowProc(hwnd, Message, wParam, lParam);
	}
	return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
	LPSTR lpCmdLine, int nCmdShow)
{
	WNDCLASSEX wc;
	HWND hwnd;
	MSG Msg;

	wc.cbSize		 = sizeof(WNDCLASSEX);
	wc.style		 = 0;
	wc.lpfnWndProc	 = WndProc;
	wc.cbClsExtra	 = 0;
	wc.cbWndExtra	 = 0;
	wc.hInstance	 = hInstance;
	wc.hIcon		 = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON));
	wc.hCursor		 = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
	wc.lpszMenuName  = MAKEINTRESOURCE(IDR_MYMENU);
	wc.lpszClassName = g_szClassName;
	wc.hIconSm		 = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 16, 16, 0);

	if(!RegisterClassEx(&wc))
	{
		MessageBox(NULL, "Window Registration Failed!", "Error!",
			MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	hwnd = CreateWindowEx(
		WS_EX_CLIENTEDGE,
		g_szClassName,
		"A Menu",
		WS_OVERLAPPEDWINDOW,
		CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
		NULL, NULL, hInstance, NULL);

	if(hwnd == NULL)
	{
		MessageBox(NULL, "Window Creation Failed!", "Error!",
			MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	ShowWindow(hwnd, nCmdShow);
	UpdateWindow(hwnd);

	while(GetMessage(&Msg, NULL, 0, 0) > 0)
	{
		TranslateMessage(&Msg);
		DispatchMessage(&Msg);
	}
	return Msg.wParam;
}

meni_one.rc

//Microsoft Developer Studio generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef __BORLANDC__
#include "winres.h"
#endif

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (Canada) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// Menu
//

IDR_MYMENU MENU DISCARDABLE 
BEGIN
    POPUP "&File"
    BEGIN
        MENUITEM "E&xit",                       ID_FILE_EXIT
    END
    POPUP "&Stuff"
    BEGIN
        MENUITEM "&Go",                         ID_STUFF_GO
        MENUITEM "Go &Somewhere Else",          ID_STUFF_GOSOMEWHEREELSE
        , GRAYED
    END
END


#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#ifndef __BORLANDC__\r\n"
    "#include ""winres.h""\r\n"
    "#endif\r\n"
    "\0"
END

3 TEXTINCLUDE DISCARDABLE 
BEGIN
    "\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MYICON              ICON    DISCARDABLE     "menu_one.ico"
#endif    // English (Canada) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

resource.h

//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by menu_one.rc
//
#define IDR_MYMENU                      101
#define IDI_MYICON                      102
#define ID_FILE_EXIT                    40001
#define ID_STUFF_GO                     40002
#define ID_STUFF_GOSOMEWHEREELSE        40003

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        103
#define _APS_NEXT_COMMAND_VALUE         40004
#define _APS_NEXT_CONTROL_VALUE         1000
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

The icon called by "menu_one" file is in the folder with rest of the files(menu_one.c,menu_one.rc,resource.h).

From a long time spending.

And why the project have a several mistakes when i put the files ( rc , c, h) into project?

What are the errors? Post a few of them.

First is called Project1_private.rc Computer open by himself

/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */
/* DO NOT EDIT! */

#include "../New Folder/menu_one.rc"

In 4 line.

Second is in File menu_one.rc ,11 line.
3. is also in menu_one.rc ,22 line.
And forth error is i will type a message
"[Build Error] [Project1_private.res] Error 1"

Ancient Dragon ,coud you write me what write in your tools->compiler option->compailer->Add these commands to linker command line.

Nothing -- it is blank. I use the default settings when the compiler is installed.

Do you have a same problem or is a problem with me?
Do you have .NET Framework 2.0 Software Development Kit (SDK) (x86)?

I am running Vista Home Premium with default installation and all Microsoft updates. I just now created a new project and added the files you posted. Dev-C++ compiled them without warnings or errors, and ran ok too. Attached are my project files. After unziping it into the directory of your choice use Dev-C++ to open the file Project1.dev

Your Project1.dev does't include files like ( c , rc , h).So when i put it it put me again this message.
I note it something when i start project who allready exist in Example of Dev-C++
program->FileEditor ,i can compaile and run this program who also have (rc , h, c) files but with some exception ,when i go to the project option->Files->and click on the ( rc ) file the the Dev-C++ included linking.
And when i make a project he does not include linking.
So ,Ancient Dragon does it mind anything to you?
Please do not say no.

>>Your Project1.dev does't include files like ( c , rc , h).
Yes it does -- but it contains main.cpp not main.c. So I just no renamed it to main.c and recompiled. No problems with that either.

>>when i go to the project option->Files->and click on the ( rc ) file the the Dev-C++ included linking.
Mine was clicked by default and greyed out so that I can't change it. See attached bitmap

>>So ,Ancient Dragon does it mind anything to you?
If you mean do I get any errors -- No I don't.

>>when i go to the project option->Files->and click on the ( rc ) file the the Dev-C++ included linking.
Mine was clicked by default and greyed out so that I can't change it. See attached bitmap

Yes i have that too ,but when i load the project from Dev-C++->Example.
If i made it myself and add the files it not greyed so i can't change it.

After a several trying to download ,i succeed to open your zip file.And have a two Folders Test and Project1 and it Works ofcourse.
But the exe your file and exe of author file is very different.

>>But the exe your file and exe of author file is very different.

I don't know what the difference is. I just used the code you posted earlier, nothing more and nothing less. If it isn't the same as in the tutorial its up to you to determine the difference.

I reslove my generaly problem,but the other one come to me. :( With some modification of .rc file.

//Microsoft Developer Studio generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//


/////////////////////////////////////////////////////////////////////////////
//
// Menu
//

IDR_MYMENU MENU DISCARDABLE 
BEGIN
    POPUP "&File"
    BEGIN
        MENUITEM "E&xit",                       ID_FILE_EXIT
    END
    POPUP "&Stuff"
    BEGIN
        MENUITEM "&Go",                         ID_STUFF_GO
        MENUITEM "Go &Somewhere Else",          ID_STUFF_GOSOMEWHEREELSE
        , GRAYED
    END
END


#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#ifndef __BORLANDC__\r\n"
    "#include ""winres.h""\r\n"
    "#endif\r\n"
    "\0"
END

3 TEXTINCLUDE DISCARDABLE 
BEGIN
    "\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.

/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

I get the .exe like the author of the book file from my project.But a can't set up a icon.
There is a bug because when i compile without icon it's working.
When i compiled and then set up a icon and compile and remove the icon and again compiled he won't to work how he works before setting the icons.And all of stuff when setting the option after
i put files ,In this case.UHHHHHHH

And my errors is when i put the mighty icon.

cannot find -lobjc

ld returned 1 exit status

C:\Dev-Cpp\Makefile.win [Build Error] [Project1.exe] Error 1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.