Hello amos2323,
I'm assuming you have your PC connected to your TV via HDMI? If so, you're probably getting sound from the PC to your TV just fine through the HDMI connection. It could be that your PC is setup to send audio through the HDMI connection only. In this case, you'll have to play around with your PC audio-out settings to see of you can stop routing audio through the HDMI connection and send it through the optical connection. Also, make sure you have the latest driver for your sound card.
Another option, if you're getting sound to your TV via HDMI, you can run your optical from your TV to your surround sound (assuming your TV has an optical-out connection). This would eliminate the need to make any configuration changes...