Here is the solution to my problem:
I wasn't using a valid hostaddr. The correct way for me to connect to my own local server was with:
host=localhost
I also deleted dbname=Project. I was getting a message saying that it wasn't a real database. I guess I didn't need to call dbname in PQconnectdb.
Now when I run it with these changes, I get:
Msg: Connection ok
Disconnected