Re: How do I give my program an icon?
I will try that, thank you so much!
But at 1.; Do I have to create a new .cpp file? And then in the solution explorer, I add the .rc file?
Or just create a blank .rc file with notepad and add 3. into it?
I don't use the "project" stuff.
I just use "New File" and then I set it to .cpp and then I start coding.
Re: How do I give my program an icon?
Quote:
Originally Posted by
realchamp
Or just create a blank .rc file with notepad and add 3. into it?
Sure you can do that.
A resource file is just a text file with .rc extension.
VC++ 2008 express edition doesn't have a resource editor,
but that doesn't mean you can manage your resources :)
in all, you need a total of three files.
1. whatever.cpp
2. whateverName.rc
3. whateverIcon.ico
unless you can follow richard_tominez's answer on how to manually bind the resource file
to the exe file,
your best chance is to let your project manager (or solution manager) to do the job.
Quote:
I don't use the "project" stuff.
Hehe, you might want to start using it because you will eventually need it. ;)
For example, NetBeans (another cool IDE) PM checks code file dependancy by refactoring,
something you can definitely appreciate.
Re: How do I give my program an icon?
Okay... I tryed both ways. The one of them gave me 78 errors. (Using the project).
I tryed the one with compiling, just getting unknown command "windres".
I wanna use the windres.
However with this in my code:
Code:
#define MY_ICON
using namespace std;
int main()
{
MY_ICON ICON "icon.ico";
bool quit = false;
while (! quit)
{
And this in my icon.rc:
Both my icon.ico and .rc are in the same folder as my main .cpp is.
However when I use the 1 you both set, I get errors. Without it, no errors at all. But the ICON didn't work on my program.
Re: How do I give my program an icon?
Quote:
Originally Posted by
realchamp
Both my icon.ico and .rc are in the same folder as my main .cpp is.
Great, stay on this track. :)
this is how the rest of the files might look like
main.cpp
Code:
#include <iostream>
int main()
{
std::cout << "Hello world!" << std::endl;
return 0;
}
myresource.rc
Code:
101 ICON "icon.ico"
Build your project all together.
Let me know how it goes
Re: How do I give my program an icon?
Quote:
Originally Posted by
potatoCode
Build your project all together.
What do you exactly mean? Also, when I don't try to add any "icon" stuff, the program doesn't give me errors or so.
Also if you would like to, I can give you TeamViewer 4 access. Then you can see it with your own eyes.
Or we can just chat over MSN or Steam.
Only if you want.
(I hope I didn't break any forum rules there?)
Re: How do I give my program an icon?
I think we can still solve your problem here.
(and for those who might need the same help later on)
you followed everything I told you but it still didn't work?
Hm, that's odd.
What IDE are you using?
Re: How do I give my program an icon?
Okay, that's fine.
However, I'm not sure what you mean about "IDE?".. I haven't found out of what that is yet. Only guessing.
Re: How do I give my program an icon?
windres is one of the utilities of Mingw package.
To compile your .rc file in command-line using cmd shell:
Code:
c:\mingw\bin> windres -i c:\resource.rc -o c:\resource.o
where:
c:\mingw\bin> is the directory where windres is
windres is the program itself
c:\resource.rc is the input file in C:\ directory
c:\resource.o is the outpuit file in C:\ directory
The commands I gave previously are for MSYS.
Re: How do I give my program an icon?
Ohh okay.
Is the folder on my c drive a standard one? (mingw?) Or do I have to DL something?
Okay, I tryed setting it up as you created it. It works. But I don't have any resource.o file.
I ran it in a batch script.
Code:
c:\mingw\bin> windres -i c:\Plugins\srcds\resource.rc -o c:\Plugins\srcds\resource.o
Didn't work. I'm getting invalid directory or no files. Even though my files are in that directory.
(It wouldn't let me save it into c:\srcds.
However I get a new file: windres. But it's a empty and it's only a "file" (none of these .dll, .exe, .bat extensions)
Re: How do I give my program an icon?
Quote:
Originally Posted by
realchamp
However, I'm not sure what you mean about "IDE?".. I haven't found out of what that is yet. Only guessing.
Rather than ask in each your post just use google. The first link does explain it. :cool:
http://www.google.com/search?sourcei...,GGLJ:en&q=ide
Re: How do I give my program an icon?
Quote:
Originally Posted by
VictorN
- Sorry.
I just completely forgot about Google :P
Thanks :)
ps. Anyone there can help me with this?
Re: How do I give my program an icon?
[QUOTE=realchamp;1825171ps. Anyone there can help me with this?[/QUOTE]Help you with what?
What is the current state of your problem?
What IDE (VC++ 6,0, VS2002/2003/2005/2008, ...) are you using?
Re: How do I give my program an icon?
Quote:
Originally Posted by
realchamp
Also, when I don't try to add any "icon" stuff, the program doesn't give me errors or so.
You're not... you didn't do anything like change "myicon.gif" to "myicon.ico"... did you?
Re: How do I give my program an icon?
Quote:
Originally Posted by
potatoCode
You're not... you didn't do anything like change "myicon.gif" to "myicon.ico"... did you?
I didn't create the .ico.
I think he compilied it, using a template for Adobe Photoshop.
(#define "he" a freind.)
Quote:
Originally Posted by
VictorN
Help you with what?
What is the current state of your problem?
What IDE (VC++ 6,0, VS2002/2003/2005/2008, ...) are you using?
I use VC++ 2008 Express Edition.
My current state is that I can't get an icon on my program. :(
Re: How do I give my program an icon?
Quote:
Originally Posted by
realchamp
I use VC++ 2008 Express Edition.
My current state is that I can't get an icon on my program. :(
What have you already tried to do to add an icon?