Thread: dvv-cpp not able to compile?

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    731

    dvv-cpp not able to compile?

    I have ben working with dev-cpp sence I started c++, and it has ben fine until now...

    For some reason dev-cpp can compile the encrypt function (from msdn), but it can NOT compile decrypt function!

    Why is that! I noticed it can also NOT compile some other code from msdn.

    This is making me really mad, can any one help me or point me me to anouther compiler (more complete) but not Borland compiler becuase I can't get that (for certain reasons).

    Thank you!

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    It helps if you post errors.

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    crap...umm it was something like undeclared function.

    It is were you put a function in the program that doesn't exist anywere in the header files or anything else.

  4. #4
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    What's the name of the function?

  5. #5
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    there is more then one tha tdoesn't work.

    Code:
    DecryptFile(
      LPCTSTR lpFileName,
      DWORD dwReserved
    );

    should look like this

    Code:
    DecryptFile(
      arg1,  //arg1 is delcared before
      0  //must be 0
    );
    that does NOT work.

  6. #6
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    d00der... dev-c++ isn't a compiler, it's an IDE, and if you're blaming dev-c++ for the problems, you're looking in the wrong place... dev-c++ uses a MingW port of GCC/G++, which is one of the more widely used compilers... what probably happened is MSDN used some kind of propriatery headers or shortcuts that MSVC compilers let them use, but aren't portable...

    that's the type of thing you'll just have to get used to running into as a programmer, and you're going to have to learn how to deal with it...the best thing you can do is learn enough to find out what's going wrong and fix it yourself. in the end you'll be happy you did because you walk away from this with more knowledge and more experience.

    "A good crafstman never complains about his tools"
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  7. #7
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    heh, it used windows.h. Like all of the others functions I am using. It is no different then teh rest but it happens that I got other people to back me up and they some code doens't compile in dev-cpp also.

  8. #8
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Quote Originally Posted by Rune Hunter
    heh, it used windows.h. Like all of the others functions I am using. It is no different then teh rest but it happens that I got other people to back me up and they some code doens't compile in dev-cpp also.
    you didn't understand me... MSVC's version of windows.h is different from Dev-C++'s version is different from everybody else's version.

    the problem here is not bloodshed's, it's the programmer that wrote the non-portable code using non-standard functions that is to blame... now you know why we want you to use portable, standard code...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  9. #9
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    ok so then, start me off. Were and how woudl I use this code?

  10. #10
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    well, from what I can see, it looks liek the first one should be a prototype:
    Code:
    DecryptFile(LPCTSTR lpFileName,DWORD dwReserved);
    by this point, you should know what LPCTSTR and DWORD types are, and the DecyrptFile should be returning a type.

    this part looks like a call to that function:
    Code:
    DecryptFile(arg1,0);
    in that case, as long as the data types match up, it should be okay.

    last, and most importantly, where is the definition of DecryptFile?
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  11. #11
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    what do you mean by definition?

    All I know is what it does and it is stored in the windows.h. (at least should be)

  12. #12
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Quote Originally Posted by Rune Hunter
    what do you mean by definition?

    All I know is what it does and it is stored in the windows.h. (at least should be)
    well, tha's my point... AFAIK, DecryptFile() isn't standard, but I don't know much about the windows.h file (if that file itself is standard)...

    with non-standard code, you'll need to know what it does and how it does it so you can write your own definition when you get to a comiler that doesn't support it (which is probably any compiler other than what that code was already written on)

    here's to pointnig you in the right direction:

    Code:
    #include<iostream>
    
    void myFunction(int number); //prototype
    
    int main()
    {
        myFunction(23);  //call
    }
    
    void myFunction(int number)  //next few lines is the definition
    {
        std::cout<<"The number is: "<<number;
    }
    a small bit of research shows that DecryptClass is a boolean function, and returns zero if it fails, but they seem to be using their own version of boolean, probably signed short int or something, because their decleration is as follows:

    Code:
    BOOL DecryptFile(
      LPCTSTR lpFileName,
      DWORD dwReserved
    );
    and BOOL is not a standard data type...

    also, read the requrements for that:

    Quote Originally Posted by MSDN
    Requirements

    Client: Requires Windows XP or Windows 2000 Professional.
    Server: Requires Windows Server 2003 or Windows 2000 Server.
    Unicode: Implemented as Unicode and ANSI versions.
    Header: Declared in Winbase.h; include Windows.h.
    Library: Use Advapi32.lib.
    Last edited by major_small; 10-23-2004 at 06:38 PM.
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  13. #13
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    I think I am getting somwere. It isn't window.h it is winbase.h that is the problem. It doesn't even have the decrypt function in it!

    Then I noticed a wincrypt.h file. Hmm....maybe that will work!?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C and C++ compile speed
    By swgh in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 01-02-2007, 02:37 PM
  2. Compile as you type
    By Rocketmagnet in forum A Brief History of Cprogramming.com
    Replies: 33
    Last Post: 12-07-2006, 01:36 PM
  3. How to compile mfc libs from platform sdk
    By tjcbs in forum Windows Programming
    Replies: 6
    Last Post: 11-19-2006, 08:20 AM
  4. Compile crashes certain windows
    By Loduwijk in forum C++ Programming
    Replies: 5
    Last Post: 03-26-2006, 09:05 PM
  5. How can I compile C or C++ with Visual Studio .NET?
    By Dakkon in forum C Programming
    Replies: 8
    Last Post: 02-11-2003, 02:58 PM