It also doesn't solve the issue that I can compile and run the game using TDE while I cant using D2009.
But in your first post you said when you compile using TDE you do it in your computer home, and d2009 is in a different computer; so most likely the problem is not the compiler but the machine directx.

At your computer home check if the d3dx9d_33.dll file exist in windows\system32 folder, if so copy that to the other computer.