1. Are you a CCW permit holder, and are you carrying the gun?
If the answer is yes, failure to inform (note: 'inform', not 'wait until they ask me') is a crime. You will lose your CCW permit. Assuming you are driving your own vehicle, they will have your status as a CCW permit holder before they approach your vehicle. If not, they'll have it once the run your DL.
2. Assuming you're not a CCW permit holder, and are legally carrying a trunk gun, a gun home from the range, etc:
I would answer any questions honestly. "Do I have a gun? Yes, it is unloaded in the trunk." If he asks to see it, I, personally, would say "I do not give you consent to search my vehicle." This forces his hand. If he searches the vehicle without your consent, go along with the program. We're a nation of laws, not men; fighting The Law at the roadside gets you arrested and possibly hurt, fighting The Law in court gets you money, and goes a heck of a lot further towards curbing the State's excesses. Make note of what jurisdiction pulled you over, what officer pulled you over, the location and the time.
Depending on what lead up to you being pulled over, he very well might have probable cause to search your vehicle sans consent. If you drive a red 1995 Chevy Lumina and one was just involved in an armed robbery down the road, he has reasonable suspicion to pull you over, and if you fit the description of the robber, he has PC to search the car. I, personally, have pulled over literally dozens of vehicles over the years that looked like the right car but weren't. Sometimes you realize this upon approach, sometimes it takes a little longer to determine that you have an innocent 3rd party. Regrdless, resisting the detainment sure does not help you, and it also doesn't help the poh-leece catch the bad guy.
If the cop searches your vehicle, ask him to explain why, afterwards. You declined consent, so asking for his rationale is a perfectly reasonable question. If he's a good cop and he had a good reason for searching, he should be able to explain what was going on, hopefully to your satisfaction. Do with this information what you wish; accept it and move on, call his supervisor, call Internal Affairs, call a lawyer. All of those are legal options available to you, and each of them is a better option than either lying or resisting.
3. Assuming you're carrying a weapon illegally:
You're on your own, bud. Sorry.
Mike