Sound undeclared

This is a discussion on Sound undeclared within the C Programming forums, part of the General Programming Boards category; So I am trying to create sound in Dev C++ , I keep coming up with the problem stating that ...

  1. #1
    Registered User
    Join Date
    Dec 2012
    Posts
    15

    Sound undeclared

    So I am trying to create sound in Dev C++ , I keep coming up with the problem stating that sound delay and nosound [link error] undefined reference, So i tried creating a project with the same code and linking -lwinmm but now it just says those three things are undeclared. Can anyone help me figure this out, been searching through the forums and web for an answer.

    OS is windows 7 btw

    Code:
    #include <stdio.h>
    #include <dos.h>
    #include <conio.h>
    
    
    void my_sounds(void);
    
    
    int music(int pitch, int time)
    {
    sound(pitch);
    delay(time);
    nosound();
    return(0);
    }
    
    
    
    
    void       my_sounds(void)
     {
          sound(130);            /* make a sound at 500 Hz.*/
          delay(2000);            /* pause for 2000 milliseconds = 2 seconds  */
          nosound();
         
    
    
          
     }

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,304
    According to my quick web search, you're talking about old DOS.H functions that simply don't exist in Windows.
    In windows, Beep() as a replacement for a combination of sound() + delay() + nosound().
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Undeclared?
    By Shazarul in forum C++ Programming
    Replies: 7
    Last Post: 11-22-2011, 03:29 AM
  2. 'jmp' undeclared
    By Wertmanzzz in forum Game Programming
    Replies: 2
    Last Post: 03-30-2007, 11:46 AM
  3. cout undeclared/cin undeclared
    By akbigchillin in forum C++ Programming
    Replies: 6
    Last Post: 04-24-2006, 04:06 PM
  4. undeclared?
    By firefly in forum C++ Programming
    Replies: 9
    Last Post: 06-20-2005, 08:35 AM
  5. 'pch' undeclared
    By reRanger in forum C++ Programming
    Replies: 4
    Last Post: 11-28-2004, 06:21 PM

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