PDA

View Full Version : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory



TriKri
8th May 2010, 19:42
Hi! After a lot of trouble of making Qt work together with Boost, I had realized that I can't compile a boost application with MinGW, and that I can't compile a Qt application from Visual Studio. At least directly from visual studio. Or can I? A way that I found and which worked was to open "Visual Studio 2008 Command Prompt", cd to the folder containing the source files, type "qmake -project", then just "qmake", and finally "nmake". Or is there any simpler way? I would rather just be able to write a batch file and invoke that by double clicking on it, but I don't know how to make it run in the visual studio command prompt instead of the normal one.

Anyway, in that way I could compile a Qt hello world program (which I could only find by googling on it, not on Qt's web page!):



#include <QApplication>
#include <QPushButton>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);

QPushButton hello("Hello world!");
hello.resize(100, 30);

hello.show();
return app.exec();
}


However, after just adding the row "#include <stdint.h>", I got this error message:



.\hello_world.cpp(3) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory


Why can't the compiler find stdint.h? Don't nmake know that it's supposed to look in "C:\Program Files\Microsoft Visual Studio 9.0\VC\include" (where stdint.h is located) after include files?

Edit: I am using this program for a project in school and it's very time critical, in fact it is already quite delayed! Please, does anyone know what this problem is caused by? Am I doing this in the right way or should I do it in some other way? I am using Qt 4.6. Thank you really much in advance!

-Kristofer

squidge
9th May 2010, 00:05
Are you using the Qt plugin for Visual studio? If not, that'll make your life a lot easier. Then you can just compile your Qt code directly inside the IDE using the VS compiler.

TriKri
9th May 2010, 13:45
Thank you, I don't really know what the Qt plugin does, although when I googled it, I found this youtube video (http://www.youtube.com/watch?v=ILBYNde225Y) which helped me compile Qt from the visual studio IDE.

What I found out about stdint.h was that it is not shipped with vidual studio; that's why the compiler didn't find the file :p

Also, if I decide to move over to compiling from the visual studio command prompt again, I will try adding "INCLUDEPATH += . /usr/local/include/boost-1_33_1/" to my .pro file. Then I will have to stop writing "qmake -project" every time I compile, since the only thing it does is to create a new .pro file and overwrite the already existing one.

squidge
9th May 2010, 16:00
Yes, when you use Visual Studio, the .pro file isn't used any more. If you modify it, then you should re-import the pro file to a visual studio project file again. You don't need to drop to a command prompt to do this, you can just do "Qt->Open .Pro".

TriKri
9th May 2010, 16:18
Ok. I also saw that you could choose "Qt->Qt Options", and there you could add your qt version to a list, by specifying version name and path. I guess that when you do that, the plugin will automatically add the correct paths to the bin, include and lib folders to the visual studio options in "Tools->Options...->Projects and Solutions->VC++ Directories->", right?

I thought it was pretty clever though what they did in the video example; instead of creating a normal console application, create a makefile application; that way you can specify which command lines that should be performed when building, rebuilding, and cleaning the project. In that way, the makefiles were recreated every time you built, so updating the pro file would lead to updated makefiles.