Home Forums C Programming Errors in my program

Viewing 5 reply threads
  • Author
    Posts
    • #2067
      Anonymous
      Inactive

      I m working on small project which is bitmap compression. In this project I have to load a bitmap file and then compress it accoring to run length encoding, bitmap should be in project folder. Before compressing it I have to show the related data like size of bitmap and after compressing I have to show size of image,

      syntax for loading the bitmap ifstream file(“test.bmp”, ios::in);

      when file is loaded successfully i have to implement it compression and for compressing i implement these two functions

      my complete program is

      So this program shows errors and does not run correctly

      First error is on this line and says”7 E:MCSFALL_2007CS301ProjectImage Compressionmain.cpp
      type specifier omitted for parameter” int CompressInRLE8(BYTE* pSrcBits, CByteArray& pRLE_Bits, int& RLE_size);
      2nd error is also on this line and says”7 E:MCSFALL_2007CS301ProjectImage Compressionmain.cpp
      parse error before &'”
      3rd error is also on this line when i implement this function into main function and this error says”72 E:MCSFALL_2007CS301ProjectImage Compressionmain.cpp
      type specifier omitted for parameter”
      4th error is also on this line and says”72 E:MCSFALL_2007CS301ProjectImage Compressionmain.cpp
      parse error before ‘&'”
      5th error is on this line
      pRLEBits[dst_index++] = 1; // block of length 1
      and says”86 E:MCSFALL_2007CS301ProjectImage Compressionmain.cpp
      pRLEBits’ undeclared (first use this function)”
      6th error is on this line
      pRLEBits[dst_index++] = pSrcBits[src_index];
      and this error says
      “87 E:MCSFALL_2007CS301ProjectImage Compressionmain.cpp

      pSrcBits’ undeclared (first use this function)”
      7th error is on this line
      RLE_size = dst_index; // image size
      and this error says”208 E:MCSFALL_2007CS301ProjectImage Compressionmain.cpp
      RLE_size’ undeclared (first use this function)”
      8th error is on this line
      return 0;
      and this error says”212 E:MCSFALL_2007CS301ProjectImage Compressionmain.cpp
      parse error before `return'”

      I have not so much experience to do that kindly implement it on ur compiler and then help me to resolve these issues and so that I can implement it correctly thanks

      • This topic was modified 4 years, 7 months ago by M. Saqib.
      • This topic was modified 4 years, 7 months ago by M. Saqib.

    • #3327
      msaqib
      Participant

      Hello
      I have made few changes to your program and its working fine and shows all the details about the bitmap image. What I think is that you have copied and pasted the code from some other source, and there were some errors (might be pasting errors), that was the reason your program was not working.
      OK! I have tested your program on MS visual C++ 6 compiler and working fine. Below you can find the working code for your program. As it was an MFc application so “stdafx.h” header file has been added. Also if you goto the line (54-56) you will find that some code is commented, I think that was not a necessary code and was also creating some errors of type casting. If you really need that code to use then you will have to get around with it through some other ways.
      Because

      you can not declare an array variable with dynamic size which can change at run time. You can use some other techniques like type casting. Rest of the code is working fine.
      Oh one more thing, by default MS visual Studio environment creates a single threaded application where as the libraries used in this program are multithreaded so you might get some errors at run time. To run the program smoothly you will need to make few changes in project settings. You will need to perform the following tasks before running the project.
      Change the application to multithreaded. To do this:
      1. Go to Project Settings and select the ‘C/C++’ tab.
      2. Select ‘Code Generation’ in Category.
      3. Set Use run-time library to either Debug Multithreaded (for debug builds) or Multithreaded (for release builds).
      Best of luck with your project.

    • #3328
      Anonymous
      Inactive

      slam
      thanks dear
      u have helped me alot
      u have done goood duty as being a goood pakistani programmer
      i m also pakistani
      so thanks alot!

    • #3329
      Anonymous
      Inactive

      ok now my program is giving no errors and it is showing out put as follow

      Now I want to modify such that it should dispaly size of compressed Bitmap
      Now I want to show size of image after compressing on the screen but I don’t know how to do it
      Out put should be as Follow

      Before Compressing

      After Compressing

      Code of full program is as follow
      I m using Dev C++ Compiler and this project is a basically Console program.

      so help me to do that as quick as possible so that I can do that project very quickly Waiting for ur immediate response.

      • This reply was modified 9 years, 5 months ago by M. Saqib.
      • This reply was modified 4 years, 7 months ago by M. Saqib.
      • This reply was modified 4 years, 7 months ago by M. Saqib.
    • #3330
      Anonymous
      Inactive

      kindly reply me soon as possible becoz tommorow is last date of submision of my project

    • #3331
      Anonymous
      Inactive

      can u give me ur personal mail address

Viewing 5 reply threads
  • The forum ‘C Programming’ is closed to new topics and replies.