подскажите почему такое происходит?
От: xinom  
Дата: 02.01.08 08:19
Оценка:
Дебаг проходит нормально, а вот после компиляции вот что говорит...
------ Build started: Project: getusername, Configuration: Debug Win32 ------
Compiling...
stdafx.cpp
Compiling...
getusername.cpp
c:\documents and settings\administrator\my documents\visual studio 2005\projects\getusername\getusername\getusername.cpp(23) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\getusername\getusername\Debug\BuildLog.htm"
getusername - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Re: подскажите почему такое происходит?
От: Bell Россия  
Дата: 02.01.08 08:22
Оценка:
Здравствуйте, xinom, Вы писали:

X>Дебаг проходит нормально, а вот после компиляции вот что говорит...

X>
------ Build started: Project: getusername, Configuration: Debug Win32 ------
X>Compiling...
X>stdafx.cpp
X>Compiling...
X>getusername.cpp
X>c:\documents and settings\administrator\my documents\visual studio 2005\projects\getusername\getusername\getusername.cpp(23) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
X>Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\getusername\getusername\Debug\BuildLog.htm"
X>getusername - 1 error(s), 0 warning(s)
X>========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
X>


Ну и есть строка #include "stdafx.h" в файле getusername.cpp ?
Любите книгу — источник знаний (с) М.Горький
Re: подскажите почему такое происходит?
От: remark Россия http://www.1024cores.net/
Дата: 02.01.08 08:46
Оценка:
Здравствуйте, xinom, Вы писали:

X>Дебаг проходит нормально, а вот после компиляции вот что говорит...

X>
------ Build started: Project: getusername, Configuration: Debug Win32 ------
X>Compiling...
X>stdafx.cpp
X>Compiling...
X>getusername.cpp
X>c:\documents and settings\administrator\my documents\visual studio 2005\projects\getusername\getusername\getusername.cpp(23) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
X>Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\getusername\getusername\Debug\BuildLog.htm"
X>getusername - 1 error(s), 0 warning(s)
X>========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
X>

1024cores — all about multithreading, multicore, concurrency, parallelism, lock-free algorithms
Re: подскажите почему такое происходит?
От: Uzumaki Naruto Ниоткуда  
Дата: 02.01.08 08:56
Оценка:
Потому что в проекте указано, что он с pre-compile headers, а в файле .cpp отсутствует #include <stdafx.h> (собственно сам хедер)

Re[2]: подскажите почему такое происходит?
От: xinom  
Дата: 02.01.08 12:30
Оценка:
Собсно сразу увидел и добавил, но теперь ругнулся на синтаксис, хм...
c:\documents and settings\administrator\my documents\visual studio 2005\projects\getusername\getusername\getusername.cpp(13) : error C2065: 'DWORD' : undeclared identifier
c:\documents and settings\administrator\my documents\visual studio 2005\projects\getusername\getusername\getusername.cpp(13) : error C2146: syntax error : missing ';' before identifier 'nUserName'
c:\documents and settings\administrator\my documents\visual studio 2005\projects\getusername\getusername\getusername.cpp(13) : error C2065: 'nUserName' : undeclared identifier
c:\documents and settings\administrator\my documents\visual studio 2005\projects\getusername\getusername\getusername.cpp(14) : error C3861: 'GetUserName': identifier not found
c:\documents and settings\administrator\my documents\visual studio 2005\projects\getusername\getusername\getusername.cpp(15) : error C2065: 'cout' : undeclared identifier
c:\documents and settings\administrator\my documents\visual studio 2005\projects\getusername\getusername\getusername.cpp(15) : error C2065: 'endl' : undeclared identifier
c:\documents and settings\administrator\my documents\visual studio 2005\projects\getusername\getusername\getusername.cpp(18) : error C2065: 'cerr' : undeclared identifier
c:\documents and settings\administrator\my documents\visual studio 2005\projects\getusername\getusername\getusername.cpp(19) : error C3861: 'GetLastError': identifier not found
Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\getusername\getusername\Debug\BuildLog.htm"
getusername - 8 error(s), 0 warning(s)

сырец от туда взял
Re[3]: подскажите почему такое происходит?
От: oziro Нигерия  
Дата: 02.01.08 20:21
Оценка:
Здравствуйте, xinom, Вы писали:

X>Собсно сразу увидел и добавил, но теперь ругнулся на синтаксис, хм...

X>
X>c:\documents and settings\administrator\my documents\visual studio 2005\projects\getusername\getusername\getusername.cpp(15) : error C2065: 'cout' : undeclared identifier


боян :)
Автор: remark
Дата: 02.01.08


Код в http://tangentsoft.net/wskfaq/examples/src/getusername.cpp не соответствует современному C++. Подробрее: ищи про пространство имен std:: , заголовочные файлы #include <iostream> (без h)
Re: подскажите почему такое происходит?
От: Аноним  
Дата: 03.01.08 17:12
Оценка:
Здравствуйте, xinom, Вы писали:

X>Дебаг проходит нормально, а вот после компиляции вот что говорит...

X>
------ Build started: Project: getusername, Configuration: Debug Win32 ------
X>Compiling...
X>stdafx.cpp
X>Compiling...
X>getusername.cpp
X>c:\documents and settings\administrator\my documents\visual studio 2005\projects\getusername\getusername\getusername.cpp(23) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
X>Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\getusername\getusername\Debug\BuildLog.htm"
X>getusername - 1 error(s), 0 warning(s)
X>========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
X>


Возможно, отсутствует сам precompiled header (файл с расширением .pch). Тогда его вначале нужно создать.
В свойствах проекта в опциях компилятора стоит указать Create Precompiled Header(/Yc). Будет сгенерирован pch-файл,
который можно будет использовать. Потом это свойство снова нужно будет изменить на Use Precompiled Header(/Yu).
У меня такая проблема возникала, когда я делал Rebuild всего проекта.
Во время этой операции предыдущий pch-файл был удален, а новый не создан.
Re[2]: подскажите почему такое происходит?
От: xinom  
Дата: 04.01.08 04:25
Оценка:
В общем все ясно, что ничего не ясно=)
Ушел копать в сторону пространство имен std::...
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.