Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Alright, I figured out what was going on. When I started the project everything was in the same directory and I was using a .pro file. I needed to include the ui_form.h file in my form.cpp file to be able to access my buttons. When I would build the project this way, the ui_form.h file would be generated and stayed in the same directory as all of the other files.

I then decided to organize my project into include, src, ui, and resources folders. Since the ui_form.h file was a header file, I moved it to the include folder and updated my include statement to look in the include directory. Around this time, I switched to using CMake and discovered that the files were not updating when I changed the interface. I thought I would just delete the ui_form.h, since it was auto-generated. I did and a got a compiler error because my include statement pointed to the include directory.

I just realized that CMake puts the ui_form.h file in the build directory. I deleted the one I had in the include directory and changed my include statements in form.cpp to

#include "../build/ui_form.h"

instead of

#include ../include/ui_form.h

I am still not sure if this is the best way to do it since the build directory could be changed, but at least everything is working now.