| Martiial Temat założony przez niniejszego użytkownika | fatal error C1189: #error :  "include 'stdafx.h' before including this file for PCH" » 2016-04-17 17:10:27 Mam taki problem. Jak wyłączyłem Precompiled Headers to miałem 57 errorów, a jak włączone, to ten jeden.Cały error:
 1>------ Build started: Project: entername, Configuration: Debug Win32 ------
 1>Compiling...
 1>stdafx.cpp
 1>c:\users\karol\documents\visual studio 2005\projects\entername\entername\tscanner.h(7) : fatal error C1189: #error :  "include 'stdafx.h' before including this file for PCH"
 1>Build log was saved at "file://c:\Users\Karol\Documents\Visual Studio 2005\Projects\entername\entername\Debug\BuildLog.htm"
 1>entername - 1 error(s), 0 warning(s)
 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 
 
 Kod plików:
 
 
 entername.cpp
 #include "stdafx.h"
 #include "tScanner.cpp"
 #include "tScannerDlg.cpp"
 #include "tCapture.cpp"
 #include "tCaptureDlg.cpp"
 #include "tPreview.cpp"
 #include "tPreviewDlg.cpp"
 
 #include <string>
 #include <iostream>
 #include <cstdlib>
 
 #define ID_BUTTON 1
 #define ID_LISTBOX 2
 
 LPSTR NazwaKlasy = "Klasa Okienka";
 MSG Komunikat;
 HWND hwnd,g_hPrzycisk,hEdit,hListBox;
 LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
 
 int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
 {
 
 WNDCLASSEX wc;
 
 wc.cbSize = sizeof( WNDCLASSEX );
 wc.style = 0;
 wc.lpfnWndProc = WndProc;
 wc.cbClsExtra = 0;
 wc.cbWndExtra = 0;
 wc.hInstance = hInstance;
 wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
 wc.hCursor = LoadCursor( NULL, IDC_ARROW );
 wc.hbrBackground =( HBRUSH )( COLOR_WINDOW + 1 );
 wc.lpszMenuName = NULL;
 wc.lpszClassName = NazwaKlasy;
 wc.hIconSm = LoadIcon( NULL, IDI_APPLICATION );
 
 if( !RegisterClassEx( & wc ) )
 {
 MessageBox( NULL, "Odmawia rejestracji tego okna!", "Niestety...",
 MB_ICONEXCLAMATION | MB_OK );
 return 1;
 }
 
 hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, NazwaKlasy, "Okno", WS_OVERLAPPEDWINDOW,
 CW_USEDEFAULT, CW_USEDEFAULT, 200, 250, NULL, NULL, hInstance, NULL );
 
 g_hPrzycisk = CreateWindowEx( 0, "BUTTON", "Zapisz", WS_CHILD | WS_VISIBLE,
 100, 150, 60, 30, hwnd, NULL, hInstance, NULL );
 
 hEdit = CreateWindowEx( 0, "EDIT", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, 15, 150, 60, 30,
 hwnd, NULL, hInstance, NULL );
 SetWindowText( hEdit, "Wpisz" );
 DWORD dlugosc = GetWindowTextLength( hEdit );
 LPSTR Bufor =( LPSTR ) GlobalAlloc( GPTR, dlugosc + 1 );
 GetWindowText( hEdit, Bufor, dlugosc + 1 );
 
 hListBox = CreateWindowEx( WS_EX_CLIENTEDGE, "LISTBOX", NULL, WS_CHILD | WS_VISIBLE | WS_BORDER |
 WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL, 15, 15, 150, 100, hwnd, NULL, hInstance, NULL );
 
 
 
 if( hwnd == NULL )
 {
 MessageBox( NULL, "Okno odmówi³o!", "Ale kicha...", MB_ICONEXCLAMATION );
 return 1;
 }
 
 ShowWindow( hwnd, nCmdShow );
 UpdateWindow( hwnd );
 
 while( GetMessage( & Komunikat, NULL, 0, 0 ) )
 {
 TranslateMessage( & Komunikat );
 DispatchMessage( & Komunikat );
 }
 return static_cast<int>(Komunikat.wParam);
 }
 
 LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
 {
 switch( msg )
 {
 case WM_COMMAND:{
 switch(wParam){
 case ID_BUTTON:{
 
 unsigned int iSize = GetWindowTextLength(hEdit);
 char *cText = new char[iSize+1];
 GetWindowTextA(hEdit, cText, iSize+1);
 
 delete cText;
 for(int it=0; it<SendMessage(hListBox, LB_GETCOUNT, 0, 0); ++it)
 {
 iSize = SendMessage(hListBox, LB_GETTEXTLEN, 0, 0);
 cText = new char[iSize+1];
 SendMessage(hListBox, LB_GETTEXT, it, (LPARAM)cText);
 delete cText;
 }
 break;
 }
 }
 break;
 }
 case WM_CLOSE:
 DestroyWindow( hwnd );
 break;
 
 case WM_DESTROY:
 PostQuitMessage( 0 );
 break;
 
 default:
 return DefWindowProc( hwnd, msg, wParam, lParam );
 }
 
 return 0;
 }
 tCapture.h
 // tCapture.h : main header file for the PROJECT_NAME application
 //
 
 #pragma once
 
 #ifndef __AFXWIN_H__
 #error "include 'stdafx.h' before including this file for PCH"
 #endif
 
 #ifdef STANDARDSHELL_UI_MODEL
 #include "resourceC.h"
 #endif
 
 // CtCaptureApp:
 // See tCapture.cpp for the implementation of this class
 //
 
 class CtCaptureApp : public CWinApp
 {
 public:
 CtCaptureApp();
 
 // Overrides
 public:
 virtual BOOL InitInstance();
 
 // Implementation
 
 DECLARE_MESSAGE_MAP()
 };
 
 extern CtCaptureApp theApp;
 
 tPreview.h
 // tPreview.h : main header file for the PROJECT_NAME application
 //
 
 #pragma once
 
 #ifndef __AFXWIN_H__
 #error "include 'stdafx.h' before including this file for PCH"
 #endif
 
 #ifdef STANDARDSHELL_UI_MODEL
 #include "ResourceP.h"
 #endif
 
 // CtPreviewApp:
 // See tPreview.cpp for the implementation of this class
 //
 
 class CtPreviewApp : public CWinApp
 {
 public:
 CtPreviewApp();
 
 // Overrides
 public:
 virtual BOOL InitInstance();
 
 // Implementation
 
 DECLARE_MESSAGE_MAP()
 };
 
 extern CtPreviewApp theApp;
 
 tScanner.h
 // tScanner.h : main header file for the PROJECT_NAME application
 //
 #include "stdafx.h"
 #pragma once
 
 #ifndef __AFXWIN_H__
 #error "include 'stdafx.h' before including this file for PCH"
 #endif
 
 #ifdef STANDARDSHELL_UI_MODEL
 #include "resourceS.h"
 #endif
 
 // CtScannerApp:
 // See tScanner.cpp for the implementation of this class
 //
 
 class CtScannerApp : public CWinApp
 {
 public:
 CtScannerApp();
 
 // Overrides
 public:
 virtual BOOL InitInstance();
 
 // Implementation
 
 DECLARE_MESSAGE_MAP()
 };
 
 extern CtScannerApp theApp;
 
 stdafx.h
 // stdafx.h : include file for standard system include files,
 // or project specific include files that are used frequently, but
 // are changed infrequently
 //
 
 #pragma once
 
 // Modify the following defines if you have to target a platform prior to the ones specified below.
 // Refer to MSDN for the latest info on corresponding values for different platforms.
 #ifndef WINVER				// Allow use of features specific to Windows XP or later.
 #define WINVER 0x0501		// Change this to the appropriate value to target other versions of Windows.
 #endif
 
 #ifndef _WIN32_WINNT		// Allow use of features specific to Windows XP or later.
 #define _WIN32_WINNT 0x0501	// Change this to the appropriate value to target other versions of Windows.
 #endif
 
 #ifndef _WIN32_WINDOWS		// Allow use of features specific to Windows 98 or later.
 #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
 #endif
 
 #ifndef _WIN32_IE			// Allow use of features specific to IE 6.0 or later.
 #define _WIN32_IE 0x0600	// Change this to the appropriate value to target other versions of IE.
 #endif
 
 #define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
 // Windows Header Files:
 #include <windows.h>
 
 // C RunTime Header Files
 #include <stdlib.h>
 #include <malloc.h>
 #include <memory.h>
 #include <tchar.h>
 
 // TODO: reference additional headers your program requires here
 #include "tScanner.h"
 #include "tScannerDlg.h"
 #include "tPreview.h"
 #include "tPreviewDlg.h"
 #include "tCapture.h"
 #include "tCaptureDlg.h"
 #include "BCDApi.h"
 
 tCaptureDlg.h
 // tCaptureDlg.h : header file
 //
 
 #pragma once
 
 // CtCaptureDlg dialog
 class CtCaptureDlg : public CDialog
 {
 // Construction
 public:
 CtCaptureDlg(CWnd* pParent = NULL);	// standard constructor
 
 // Dialog Data
 enum { IDD = IDD_TCAPTURE_DIALOG };
 
 public:
 virtual BOOL DestroyWindow();
 protected:
 virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
 
 // Implementation
 protected:
 HICON m_hIcon;
 
 // Generated message map functions
 virtual BOOL OnInitDialog();
 afx_msg void OnButtonCapture();
 afx_msg void OnButtonSave();
 afx_msg void OnPaint();
 DECLARE_MESSAGE_MAP()
 };
 
 Jak będzie potrzeba dodania jeszcze innych plików to pisać to wkleję.
 
 |