CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 47
  1. #31
    Join Date
    Mar 2008
    Posts
    30

    Re: How do I give my program an icon?

    Try it again. I should also noted that c:\mingw\bin> is the working directory.
    1. Run cmd from the start menu
    2. Change the current directory in the bin folder in your mingw installation
    Code:
    cd c:\mingw\bin
    3. Run windres like this:
    Code:
    windres -i c:\resource.rc -o c:\resource.o
    If still doesn't work, I suggest, you pray to St. Anthony of Padua that you may found the answer.
    Last edited by richard_tominez; March 23rd, 2009 at 09:31 AM.

  2. #32
    Join Date
    Feb 2009
    Posts
    201

    Re: How do I give my program an icon?

    Well thanks, once agian richard_tominez.

    But, when I do that. The cd c:\mingw\bin

    Gives me an invalid directory. Like it doesn't exits. However I can't see it either. (When I open up my C folder)

    I'm on Windows Vista 32BIT: Home Premium, if that should do any different.'

    EDIT: I used google, now I'm downloading that mingw.
    Last edited by realchamp; March 23rd, 2009 at 12:59 PM.

  3. #33
    Join Date
    Feb 2009
    Posts
    201

    Re: How do I give my program an icon?

    Okay, now I got it installed. It doesn't say unknow command anymore.

    But when I try to compile it, I get these errors:

    Code:
    C:\Plugins\srcds>cd c:\mingw\bin
    
    c:\MinGW\bin>windres -i C:\Plugins\srcds\resource.rc -o C:\Plugins\srcds\resourc
    e.o
    C:\Plugins\srcds\resource.rc:1:24: warning: no newline at end of file
    windres: can't open icon file `resource.ico': No such file or directory
    
    c:\MinGW\bin>pause
    In my C:\Plugins\srcds\ folder I have these files:
    resource.ico
    resource.rc with this data:
    Code:
    101 ICON "resource.ico"
    resource.bat with this data:
    Code:
    cd c:\mingw\bin
    windres -i C:\Plugins\srcds\resource.rc -o C:\Plugins\srcds\resource.o
    pause
    And I do also have my main program.


    EDIT:

    Now I got the resource.o file.

    Code:
    C:\Plugins\srcds>cd c:/mingw/bin
    
    c:\MinGW\bin>g++ resource.o c:/Plugins/srcds/srcds_beta.cpp -o main
    
    c:/Plugins/srcds/srcds_beta.cpp: In function `int main()':
    c:/Plugins/srcds/srcds_beta.cpp:88: warning: `_sleep' is deprecated (declared at
     ../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:404)
    c:/Plugins/srcds/srcds_beta.cpp:88: warning: `_sleep' is deprecated (declared at
     ../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:404)
    c:/Plugins/srcds/srcds_beta.cpp:213: warning: `_sleep' is deprecated (declared a
    t ../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:404)
    c:/Plugins/srcds/srcds_beta.cpp:213: warning: `_sleep' is deprecated (declared a
    t ../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:404)
    c:/Plugins/srcds/srcds_beta.cpp:223:2: warning: no newline at end of file
    
    c:\MinGW\bin>pause

    Why now this?

    Please someone help me!

    I compiled my srcds_beta.cpp in VC++ 2008: Express Edition.

    I didn't get any errors.

    And now this:
    Code:
    C:\Plugins\srcds>cd c:/mingw/bin
    
    c:\MinGW\bin>g++ resource.o c:/Plugins/srcds/srcds_beta.cpp -o c:\Plugin\srcds\s
    rcds_beta.exe
    c:/Plugins/srcds/srcds_beta.cpp: In function `int main()':
    c:/Plugins/srcds/srcds_beta.cpp:88: warning: `_sleep' is deprecated (declared at
     ../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:404)
    c:/Plugins/srcds/srcds_beta.cpp:88: warning: `_sleep' is deprecated (declared at
     ../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:404)
    c:/Plugins/srcds/srcds_beta.cpp:213: warning: `_sleep' is deprecated (declared a
    t ../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:404)
    c:/Plugins/srcds/srcds_beta.cpp:213: warning: `_sleep' is deprecated (declared a
    t ../lib/gcc/mingw32/3.4.5/../../../../include/stdlib.h:404)
    c:/Plugins/srcds/srcds_beta.cpp:223:2: warning: no newline at end of file
    ..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot open output file
     c:\Plugin\srcds\srcds_beta.exe: No such file or directory
    collect2: ld returned 1 exit status
    
    c:\MinGW\bin>pause
    Last edited by realchamp; March 23rd, 2009 at 02:47 PM.

  4. #34
    Join Date
    Feb 2009
    Posts
    201

    Re: How do I give my program an icon?

    Someone please help. I wanna get this to work!

    Hehe, tell me if you need more information!

  5. #35
    Join Date
    Mar 2008
    Posts
    30

    Re: How do I give my program an icon?

    _sleep function is obsolete. Try including windows.h to use Sleep function as a replacement to it.
    Last edited by richard_tominez; March 24th, 2009 at 02:53 AM.

  6. #36
    Join Date
    Feb 2009
    Posts
    201

    Re: How do I give my program an icon?

    I already included it.

    When I run my own program in VC++ 2008: Express Version, it works perfect. No errors at all! (with _sleep(2000))

    Here's my headers:
    Code:
    #include <iostream>
    #include <fstream>
    #include <cstring>
    #include <stdlib.h>
    #include <string>
    #include <direct.h>
    #include <Windows.h>
    #include <WinBase.h>
    Last edited by realchamp; March 24th, 2009 at 07:49 AM.

  7. #37
    Join Date
    Mar 2008
    Posts
    30

    Re: How do I give my program an icon?

    Code:
    #include <iostream>
    #include <fstream>
    #include <cstring>
    #include <stdlib.h>
    #include <string>
    #include <direct.h>
    #include <Windows.h>
    #include <WinBase.h>
    Windows.h is different from windows.h.
    Anyways, your problem is how to give your program an icon. The important matter is you know the steps to give your program an icon. Create a simple Hello World program with your resource.o and see what you got.
    Last edited by richard_tominez; March 25th, 2009 at 02:23 AM.

  8. #38
    Join Date
    Feb 2009
    Posts
    201

    Re: How do I give my program an icon?

    Now my program doesn't know "cout".

    Here's my code:

    Code:
    // hello_world.cpp : Defines the entry point for the console application.
    //
    
    #include "stdafx.h"
    #include <iostream>
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	cout << "Hello World!";
    }

    And error:

    Code:
    1>------ Build started: Project: hello_world, Configuration: Debug Win32 ------
    1>Compiling...
    1>hello_world.cpp
    1>c:\plugins\srcds\beta\hello_world\hello_world\hello_world.cpp(9) : error C2065: 'cout' : undeclared identifier
    1>Build log was saved at "file://c:\Plugins\srcds\beta\hello_world\hello_world\Debug\BuildLog.htm"
    1>hello_world - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    I included the <iostream> in the main file. Didn't work.

    I also added the resource.o to resources.

    It said "unknown rules" - I just ran throught and it worked.(I hope)

  9. #39
    Join Date
    Mar 2008
    Posts
    30

    Re: How do I give my program an icon?

    cout is a member of the std namespace. To use it:
    Code:
    std::cout << "Hello World!";

  10. #40
    Join Date
    Feb 2009
    Posts
    201

    Re: How do I give my program an icon?

    Quote Originally Posted by richard_tominez View Post
    cout is a member of the std namespace. To use it:
    Code:
    std::cout << "Hello World!";
    Ohh well I forgot the:

    Code:
    using namespace std;
    Thanks alot! I'm going to try it and give you a feedback!

    - realchamp.

  11. #41
    Join Date
    Feb 2009
    Posts
    201

    Re: How do I give my program an icon?

    Hello, it works! No errors on compiling.

    However when I use the project manager I don't get any .exe file? :/

    So I can't really check if it works

  12. #42
    Join Date
    Mar 2008
    Posts
    30

    Re: How do I give my program an icon?

    No errors on compiling? How about on linking?

  13. #43
    Join Date
    Feb 2009
    Posts
    201

    Re: How do I give my program an icon?

    What do you mean by "linking?"

  14. #44
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: How do I give my program an icon?

    Quote Originally Posted by realchamp View Post
    What do you mean by "linking?"
    Don't you know what "linking" (or Link) is?
    Very bad!
    Can't you use Internet search?
    Well, checking out some of these sites will be a good start for you:
    http://www.google.de/search?hl=en&rl...nk&btnG=Search
    Victor Nijegorodov

  15. #45
    Join Date
    Feb 2009
    Posts
    201

    Re: How do I give my program an icon?

    I know what a "link" is.

    Like a link to Google.

    But I don't understand what he means with "on linking?"

Page 3 of 4 FirstFirst 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured