shellapi.h not compiling with devc++4

This is a discussion on shellapi.h not compiling with devc++4 within the Windows Programming forums, part of the Platform Specific Boards category; hi there i'm fairly new to C++, and after reading about all the basics, i tried to write this simple ...

  1. #1
    Registered User whackaxe's Avatar
    Join Date
    Mar 2004
    Posts
    332

    shellapi.h not compiling with devc++4

    hi there

    i'm fairly new to C++, and after reading about all the basics, i tried to write this simple program (or so I thought )

    Code:
    #include <stdio.h>
    #include <iostream.h>
    #include <shellapi.h>
    
    int main()
    {
      ShellExecute(NULL,"open","C:\windows\notepad",NULL,NULL,SW_SHOWMAXIMIZED);
      exit(0);
    }
    when i try to compile i get the errors included in the text file

    using dev C++ 4

    thanks for the help
    Attached Files Attached Files

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,453
    > #include <stdio.h>
    > #include <iostream.h>
    Choose C or C++
    One is a C header file, and the other is a C++ header file

    > #include <shellapi.h>
    Everything windows-y begins with
    #include <windows.h>
    So include that before including anything else from windows.

    > "C:\windows\notepad"
    Don't forget the quoting rules for strings
    "C:\\windows\\notepad"
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User whackaxe's Avatar
    Join Date
    Mar 2004
    Posts
    332
    thank you muchly

    is iostream.h basicly the same as stdio.h or is there a C++ equivelent to stdio.h?

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,453
    iostream is to C++ as stdio is to C

    Do you have the latest Dev-C++?
    Because
    #include <iostream.h>
    is old style C++

    The new style C++ goes something like this
    #include <iostream>
    using namespace std;


    Later on, when writing much larger programs, you can fine-tune the using command to be more specific.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User whackaxe's Avatar
    Join Date
    Mar 2004
    Posts
    332
    thank you for the info.

  6. #6
    Registered User
    Join Date
    Mar 2004
    Posts
    44

    salem is wrong

    salem you said that iostream.h or iostream is the same as stdio.h but that is not true iostream.h declares the input/output streams only but stdio.h declares the iostreams and functions and includes io function definitions

  7. #7
    Registered User dalek's Avatar
    Join Date
    May 2003
    Posts
    135
    No, Salem isn't wrong. He didn't say they are the same, he said that iostream is to C++ as stdio is to C. Which is in fact quite different to saying they are the same.

    All he is getting at is that you need to have iostream when writing a C++ program and in much the same way you need stdio.h when writing a C program.

    It is worth noting now that stdio.h is also available in C++ as cstdio.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie Compiling Problem
    By Deronius in forum C++ Programming
    Replies: 3
    Last Post: 06-15-2008, 11:23 AM
  2. Problem compiling files that store functions
    By tiachopvutru in forum C++ Programming
    Replies: 10
    Last Post: 05-30-2008, 05:42 PM
  3. Compiling Issues
    By pc_doctor in forum C Programming
    Replies: 3
    Last Post: 11-30-2007, 09:00 AM
  4. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  5. compiling and executing issue with lcc win32
    By GanglyLamb in forum C Programming
    Replies: 10
    Last Post: 12-22-2004, 01:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21