In the later movies, when Harry sees Voldemort, his scar hurts.
But why, in Chamber of Secrets, did his scar not hurt when he saw Tom Riddle, which later in the film is revealed to be Lord Voldemort's alter ego?
Harry's scar only ever hurts him in the presence of a real, "living" Voldemort that is feeling strong negative emotions.
In Philosopher's Stone, Voldemort is attached to Quirrell's head and is drinking unicorn blood to survive, so it's genuinely Voldemort. This is why Harry's scar hurts him from time to time, because he's passing by Quirrell in the corridors and Voldemort is particularly pissed at not being able to get the stone.
In Chamber of Secrets, it's only a projection from a horcrux, a memory, so it's not really Voldemort yet. The life force of Ginny is slowly poured into it, and that is one of the ways a horcrux can be used to revive him. If Voldemort had successfully revived as Harry walked in, I expect his scar would have been in a considerable amount of pain.
In Prisoner of Azkaban... oh. Never mind.
From the end of Goblet onwards, Voldemort is alive once more and can even touch Harry, so in his presence Harry is in quite a bit of pain. But he's never in pain whilst in the presence of a horcrux, even when being directly affected by the locket, he feels no pain. Because when you think about it, if Harry were in pain simply by being in the presence of a horcrux, he'd be in constant agony.
There were two reasons that Harry’s scar hurt - (after he’d regained a body) when the Dark Lord felt any strong emotions, and when the Dark Lord was physically near him. It hurt when the Dark Lord felt a strong emotion because they were mentally linked because of the piece of soul. Harry’s scar also hurt when he was physically near the Dark Lord because the piece of soul in him wanted to rejoin the soul it split off from and recognized that it was supposed to be a part of.
JKR: Well, of course the pain he feels whenever Voldemort’s particularly active is this piece of soul seeking to rejoin the master soul. When his scar is hurting him so much, that’s not scar tissue hurting him. That’s this piece of soul really wanting to get back out the way it entered. It really wants to- it entered this boy’s body through a wound, and it wants to rejoin the master. So when Voldemort’s near him, when he’s particularly active, this connection, (JN: Oh, my gosh!) it was always there. That’s what I always imagined this pain was. Yes, so there you go.
- PotterCast (Dec 23, 2007)
He doesn’t feel pain near any of the Horcruxes though. He interacted with Tom Riddle while he was still in the diary without feeling any pain, he encountered the locket and the diadem without even realizing they were Horcruxes at first. He wore the locket, and although it did have negative effects on him, it didn’t cause pain in his scar.
“Curiously, it had not taken heat from his body, but lay so cold against his skin it might just have emerged from icy water. From time to time, Harry thought, or perhaps imagined, that he could feel the tiny heartbeat ticking irregularly alongside his own.”
- Harry Potter and the Deathly Hallows, Chapter 14 (The Thief)
He was also close to Nagini disguised as Bathilda Bagshot, and didn’t feel any pain in his scar because of her - he didn’t notice anything was amiss until she contacted the Dark Lord, and only then his scar started to hurt due to the Dark Lord’s extreme happiness at having located Harry.
“‘Lumos,’ said Harry, and his wand ignited. He gave a start: Bathilda had moved close to him in those few seconds of darkness, and he had not heard her approach.”
- Harry Potter and the Deathly Hallows, Chapter 17 (Bathilda’s Secret)
This is likely because the piece of soul in Harry recognized only the main part of the Dark Lord’s soul as the master soul it wants to rejoin - it therefore only hurt around that piece.