Thread: Bor to DevC++ prog convert prob

  1. #1
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638

    Bor to DevC++ prog convert prob

    Converting Borland prog to DevC++. Compiled and ran just fine with borland meow.

    What is wrong with this?
    Code:
    		pszFileText = GlobalAlloc(GPTR, dwFileSize + 1);
    Code:
    437 C:\Dev-Cpp\Project2\main.c invalid conversion from `void*' to `CHAR*'
    pszFileText declared as
    Code:
    			LPSTR pszFileText;
    Functions give error of “type”
    Code:
    test( int a; int b)
    {
     int test;
    ....
    }
    Code:
    59 C:\Dev-Cpp\Project2\main.c ISO C++ forbids declaration of `test' with no type
    changed to
    Code:
    int test( int a; int b;)
    Takes care of the error. That one fixed but there are others.
    Code:
     C:\Dev-Cpp\Project2\main.c In function `BOOL LoadTextFileToEdit(HWND__*, const TCHAR*)': 
    
     C:\Dev-Cpp\Project2\main.c In function `BOOL SaveTextFileFromEdit(HWND__*, const TCHAR*)': 
    
    591 C:\Dev-Cpp\Project2\main.c invalid conversion from `void*' to `HBITMAP__*' 
    
     C:\Dev-Cpp\Project2\main.c In function `LRESULT WndProc(HWND__*, UINT, WPARAM, LPARAM)': 
    
     C:\Dev-Cpp\Project2\main.c In function `LRESULT MDIChildWndProc(HWND__*, UINT, WPARAM, LPARAM)': 
    
    1794 C:\Dev-Cpp\Project2\main.c invalid conversion from `void*' to `HFONT__*'

  2. #2
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    More accurately you are porting to MinGW, Functions should be declared with commas separating their arguments, not semicolons. All of the conversion stuff either needs proper casts or to look and find out what the real issue is, such as looking at the function declaration and the typedef that the type comes from.

  3. #3
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    Functions should be declared with commas separating their arguments, not semicolons.
    that was a typeo.

  4. #4
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    ok typecast errors fixed

    Code:
    4 C:\Dev-Cpp\Project2\Project2_private.rc In file included from Project2_private.rc 
    11 C:\Dev-Cpp\Project2\main.rc winres.h: No such file or directory. 
    22 C:\Dev-Cpp\Project2\main.rc [Resource error] syntax error 
     C:\Dev-Cpp\Project2\Makefile.win [Build Error]  [../Project2/Project2_private.res] Error 1 
    
    line in rc file
    #ifndef __BORLANDC__
    #include "winres.h"
    #endif
    what is the devcpp equivalent? Of winres.h ? Or how to get devcpp to recognize include dir .h files?

  5. #5
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    winresrc.h

  6. #6
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    ok

    Code:
    STYLE DS_MODALFRAME
    getting syntax errors in rc dialog file. looked at examples and they are numbered.

    Code:
    500 MENU
    why?

    and thank you all

    edit
    what should be numbered and what should not?
    Last edited by kryptkat; 09-15-2007 at 11:58 AM.

  7. #7
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    tried renumbering them. keep getting syntax error in resource file with things like "style" "menu" "ltext" etc.

    any ideas? numbering them did not work. even though example showed numbers.

  8. #8
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    ...

    what is the error?

  9. #9
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    Code:
    LTEXT “....
    error is
    Code:
    126 C:\Dev-Cpp\Project2\main.rc [Resource error] syntax error
    as one example.

  10. #10
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    It seems to be all the dialog resource key words that are giving the syntax errors. Could this be missing a library? Or resource compiler?

    Looked through the devcpp help file then the forums and faq then asked question here about the syntax error in the resource file. Also looked at the example code that came with devcpp and that example code ran fine but there was no dialog boxes and simple resource files. #included above .h file in .rc file that did not work. Tried numbering all keywords that also did not work

    stuck.

    Meow!

    Does the devcpp 4.9.9.2 need an additional package to work with dialog boxes and resource files?

    If so which ones?

  11. #11
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    Could we see the entire resource file? (Or a larger chunk if it's too long?)

    Dev-C++ should work as is, I think.
    Also, as for numbers, resource IDs are numbers, but usually they're #define'd in a header. Like:
    Code:
    IDM_MAINMENU MENU
    Where IDM_MAINMENU is #define'd to a number.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  12. #12
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    I saw garland thread that said
    Code:
    Now create an .*rc resource file and declare the menu inside it
    Code:
    
    #include <windows.h>
    #include "defintions.h"
    
    menu MENU
    BEGIN
        POPUP "&File"
        BEGIN
            MENUITEM "&Open",MY_FILE_OPEN
            MENUITEM "&Close",MY_FILE_CLOSE
        END
    END
    declare menu MENU that should work and it did with menu but I get syntax errors from LTEXT STYLE FONT and others.

    Code:
    #include ”main.h”
    #include<winresrc.h>
    
    ....
    
    IDR_MAINMENU MENU DISCARDABLE 
    BEGIN
        POPUP "&File"
        BEGIN
            MENUITEM "&New",                        ID_FILE_NEW
            MENUITEM "&Open...",                    ID_FILE_OPEN
            MENUITEM "Save &As...",                 ID_FILE_SAVEAS, GRAYED
            MENUITEM SEPARATOR
            MENUITEM "&Close",                      ID_FILE_CLOSE, GRAYED
            MENUITEM SEPARATOR
            MENUITEM "E&xit",                       ID_FILE_EXIT
        END
        POPUP "&Edit", GRAYED
        BEGIN
            MENUITEM "C&ut",                        ID_EDIT_CUT
            MENUITEM "&Copy",                       ID_EDIT_COPY
            MENUITEM "&Paste",                      ID_EDIT_PASTE
        END
        POPUP "&Window", GRAYED
        BEGIN
            MENUITEM "&Tile",                       ID_WINDOW_TILE
            MENUITEM "&Cascade",                    ID_WINDOW_CASCADE
        END
        POPUP "&BitMap"
        BEGIN
            MENUITEM "&NewBitMap",                        ID_FILE_NEWBITMAP
            MENUITEM "&OpenBitMap...",                    ID_FILE_OPENBITMAP
            MENUITEM "Save &As...",                 ID_FILE_SAVEASBITMAP 
            MENUITEM SEPARATOR
            MENUITEM "&CloseBitMap",                      ID_FILE_CLOSEBITMAP
            MENUITEM SEPARATOR
            MENUITEM "E&xit",                       ID_FILE_EXIT
        END
    END
    
    ....
    
    Here is where the prob is....
    
    IDD_BitMap  DIALOG DISCARDABLE 0, 0, 50, 50
    STYLE DS_MODALFRAME | DS_CENTER  | WS_CHILD | WS_VISIBLE
    CAPTION “BitMap Editor”
    
    FONT 8, "MS Sans Serif"
    
    BEGIN
    
    LTEXT           "Brush:",IDC_STATIC,25,25,20,14
    more below that are different just pasted more of the same for this thread as example only but each one gets an error if I comment it out
    
    LTEXT           "Brush:",IDC_STATIC,25,25,20,14
    LTEXT           "Brush:",IDC_STATIC,25,25,20,14
    ....
    More of these that get the same error after the above is comment out
    
        EDITTEXT        IDC_NUMBER,40,265,20,12,ES_AUTOHSCROLL | ES_NUMBER
    
    LISTBOX         IDC_LIST,7,25,138,106,LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP
    
        PUSHBUTTON      "&Add",IDC_ADD,150,30,50,14 
    
        PUSHBUTTON      "&Remove",IDC_REMOVE,150,47,50,14 
        PUSHBUTTON      "&Clear",IDC_CLEAR,150,63,50,14 
    
     GROUPBOX....
    
    CTEXT....
    
    END
    that was only one of several dialog boxes. Comment out error line and it just moves on the the next STYLE and give error then Caption then font then ltext . If type casting them is the error to what?
    I tried Hfont and text and menu and idd_main and some others nothing worked.

    also i looked at all the example code with the devcpp and downloaded some other progs which i thought had source code but did not. to look at.

    edit
    prog is MDI with several dialogs pushbuttons and bitmaps. also when i put IDC_TEXT infront of text i still get syntax error.
    i did try all the ones i could find.
    Last edited by kryptkat; 09-16-2007 at 06:27 PM.

  13. #13
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    291
    I think I posted the menu code on the garland's thread. After copy/paste/compile the part of your dialog template, I have get some resource errors on my devcpp4.9:

    1-. I suppose you have defined the dialog name 'IDD_BitMap' with a value on the definitions file.
    2-. On the line where you declare the caption, you have used “ instead " to declare textual value.
    3-. I suppose you have also defined in the definitions file the value for IDC_STATIC, IDC_NUMBER, IDC_LIST, IDC_ADD, IDC_REMOVE and IDC_CLEAR.

    After that I compiled your code without errors. Sorry for my english if something is bad explained. Take a look to that, I'm shure you should be able to make it run

    Niara

  14. #14
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    In the .h file

    Code:
    //{{NO_DEPENDENCIES}}
    // Microsoft Developer Studio generated include file.
    // Used by main.rc
    //
    #define IDR_MAINMENU                    102
    #define IDB_BOX                         104
    ....
    
    #define IDC_TEXT                        1000
    #define IDC_NUMBER                      1001
    #define IDC_LIST                        1002
    #define IDC_ADD                         1003
    #define IDC_CLEAR                       1004
    #define IDC_REMOVE                      1005
    #define IDC_SHOWCOUNT                   1006
    #define IDC_TEXTB                       1008
    ....
    
    #define ID_FILE_EXIT                    40001
    #define ID_FILE_NEW                     40002
    #define ID_FILE_OPEN                    40003
    #define ID_FILE_SAVEAS                  40005
    #define ID_WINDOW_CASCADE               40008
    #define ID_WINDOW_TILE                  40009
    #define ID_FILE_CLOSE                   40010
    #define ID_FILE_CLOSEALL                40011
    #define ID_EDIT_CUT                     40015
    #define ID_EDIT_COPY                    40016
    #define ID_EDIT_PASTE                   40017
    
    ....
    
    #define IDD_BitMap    44000
    ....
    
    #define    ID_FILE_NEWBITMAP 40020
    #define    ID_FILE_OPENBITMAP 40021
    #define    ID_FILE_SAVEASBITMAP 40022
    #define    ID_FILE_CLOSEBITMAP 40023
    
    // Next default values for new objects
    // 
    #ifdef APSTUDIO_INVOKED
    #ifndef APSTUDIO_READONLY_SYMBOLS
    #define _APS_NEXT_RESOURCE_VALUE        101
    #define _APS_NEXT_COMMAND_VALUE         40020
    #define _APS_NEXT_CONTROL_VALUE         1000
    #define _APS_NEXT_SYMED_VALUE           101
    #endif
    #endif
    there are lots more where .... is . However in the .c file there is

    Code:
    #define IDC_MAIN_MDI	101
    #define IDC_MAIN_TOOL	102
    #define IDC_MAIN_STATUS	103
    
    #define IDC_CHILD_EDIT	101
    
    #define ID_MDI_FIRSTCHILD 50000
    I am wondering if the assigned numbers need to be changed. It compiled fine with meow borland.

    2-. On the line where you declare the caption, you have used " instead " to declare textual value.
    I am not sure how that happened .... I only have one key with a single quote at the bottom and a double quote at the top that shift has to be pressed to get. I think that was a bbs thing.

    I get errors from ltext and font and style and caption. About the style I did comment it out then recompile it then uncommented it back and it did not give an error but I do not know why it went to the ltext after that. I did not really do anything. Are there any librarys that I need to include .a libthings ?

    Project options win32 gui. 3 files. Compiler opt no no no no . Par null need .a lib here? Directories lib include project2 . Build ops exeout proj2 obout proj2 outfile project2.exe . No makefile

  15. #15
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    You're using the same resource allocation twice (101). Dev should complain about that, doesn't it?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. prob with my cimple prog
    By KidMan in forum C Programming
    Replies: 3
    Last Post: 05-06-2006, 02:50 AM
  2. Prog Prob
    By polonyman in forum C++ Programming
    Replies: 10
    Last Post: 09-11-2004, 08:54 AM
  3. Convert Char to Int Function
    By drdroid in forum C++ Programming
    Replies: 9
    Last Post: 02-19-2003, 12:53 PM