Theoretical yields and determining the number of moles in a reaction
You are correct in your thinking.

First, knowing the mass of the compounds, use the molar mass relationship for each (g/mol) to convert them all to moles. This is because when it comes to reactions, compounds react on a mole or number basis.
This lets you know the "starting amounts" of $\ce{H_2O}$ and $\ce{CO_2}$. Now, our forum has a policy against providing direct answers to homework, so I'll give examples. If you hypothetically had, say, 12 moles of both water and carbon dioxide, then using the numbers in the balanced chemical equation, they can fully react to make 2 moles of glucose. Thus, 2 moles is your theoretical yield. However, in another case, if you had 9 moles of water and 14 moles of carbon dioxide, the $\ce{H_2O}$ limits the amount of glucose you can produce, and it is the limiting reactant. (14 moles of $\ce{CO_2}$ would require 14 moles of $\ce{H_2O}$. There will be some $\ce{CO_2}$ left over because you are limited by only 9 moles of $\ce{H_2O}$). In this hypothetical case, the theoretical yield would be 1.5 moles of glucose. (Your problem may or may not involve limiting/excess reactants). 

And if you're wondering, it's called "theoretical" yield because if you were carrying out this reaction in real life, some inefficiencies in combustion would yield less than the calculated amount. Hope this helps.