News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

"stdafx.h" error when building

Started by Kblavkalash, March 09, 2014, 12:13:02 PM

Previous topic - Next topic

Kblavkalash

Hello, I've got a code and a header. Now I am Windows xp in on VM from Ubuntu, and when I try to build my c++ code it says:

fatal error: stdafx.h: No such file or directory

Now if I delete this line from source code then I get:

fatal error: CodeAnalysis\SourceAnnotations.h: No such file or directory

I have that stdafx.h file in my project directory, so maybe I need to somehow tell him where to look?


stahta01

Please read and follow info on this link http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Post the "Build Log".

Post the full path to the headers reported missing.
Post the path to the Code::Blocks project file (cbp).

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Kblavkalash

Build Log:
mingw32-g++.exe   -c "C:\Documents and Settings\Administrator\Desktop\test\src1.cpp" -o "C:\Documents and Settings\Administrator\Desktop\test\src1.o"
C:\Documents and Settings\Administrator\Desktop\test\src1.cpp:1:20: fatal error: stdafx.h: No such file or directory
#include "stdafx.h"
                    ^
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))


Path to header missing: C:\Documents and Settings\Administrator\Desktop\test\sdkvcinclude
Path to source code: C:\Documents and Settings\Administrator\Desktop\test

stahta01

#3
Add the path to the header folder.

Based on this FAQ http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F

1. Click on "project" then select "Build options"
2. Select the "Search directories" tab
3. Select the "Compiler" tab
4. Click on the "Add" button
5. Click on the "..." button
6. Enter or Browse to the correct folder
7. Click on OK
8. Click on "Yes" to "Keep this path relative"
9. Click on OK
10. Click on OK

If it still fails; post the new build log; and post the path to the CB Project file.
NOTE: If your are NOT using a project; just give up on me helping you.

Tim S.

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Kblavkalash