<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Source in Header und cpp aufteilen]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich hab da mal ne Anfängerfrage. Ich habe ein Programm geschrieben und da ichs nicht besser wusste hab ich alles in die Header Datei reingeschmissen.</p>
<pre><code class="language-cpp">#ifndef _SOPAS_USB_HOST_
#define _SOPAS_USB_HOST_

#include &lt;setupapi.h&gt; 
#include &quot;usbInterface.h&quot;;
extern &quot;C&quot; 
{ 
	#include &lt;hidsdi.h&gt; 
} 

class usbHost
{
	public:
						usbHost( );
					//	~usbHost( );
		int				getNumInterfaces( void );
		bool			getUsbInterface( int, usbInterface* );
		bool			getUsbInterface( int, int, TCHAR*, usbInterface* );		
		bool			getInterfacePath( int, int, TCHAR*, TCHAR* );

	private:
		int				numInterfaces;
		int				hidGetNumInterfaces( );
		void			hidGetUsbInterfaces( );		
		usbInterface*	foundUsbInterfaces;
};

bool usbHost::getUsbInterface( int number, usbInterface* usb_interface )
{	
	*usb_interface = foundUsbInterfaces[number];
	return ( number &lt;= numInterfaces );

...

#endif
}
</code></pre>
<p>so in der Art kann man sich das vorstellen. Jetzt würde ich das ganze gerne in eine Header und in eine .cpp Datei unter VC++2005 aufteilen, nur wenn ich den Deklarationsteil in die cpp Datei packe, dann mault mir der Compiler vor</p>
<pre><code>fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include &quot;stdafx.h&quot;' to your source?
</code></pre>
<p>was mach ich denn falsch?</p>
<p>(in der cpp Datei include ich dann nur noch den Header)</p>
<p>Grüße Nils</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/163035/source-in-header-und-cpp-aufteilen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 12 Sep 2026 22:30:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/163035.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 25 Oct 2006 12:56:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Source in Header und cpp aufteilen on Wed, 25 Oct 2006 12:56:30 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich hab da mal ne Anfängerfrage. Ich habe ein Programm geschrieben und da ichs nicht besser wusste hab ich alles in die Header Datei reingeschmissen.</p>
<pre><code class="language-cpp">#ifndef _SOPAS_USB_HOST_
#define _SOPAS_USB_HOST_

#include &lt;setupapi.h&gt; 
#include &quot;usbInterface.h&quot;;
extern &quot;C&quot; 
{ 
	#include &lt;hidsdi.h&gt; 
} 

class usbHost
{
	public:
						usbHost( );
					//	~usbHost( );
		int				getNumInterfaces( void );
		bool			getUsbInterface( int, usbInterface* );
		bool			getUsbInterface( int, int, TCHAR*, usbInterface* );		
		bool			getInterfacePath( int, int, TCHAR*, TCHAR* );

	private:
		int				numInterfaces;
		int				hidGetNumInterfaces( );
		void			hidGetUsbInterfaces( );		
		usbInterface*	foundUsbInterfaces;
};

bool usbHost::getUsbInterface( int number, usbInterface* usb_interface )
{	
	*usb_interface = foundUsbInterfaces[number];
	return ( number &lt;= numInterfaces );

...

#endif
}
</code></pre>
<p>so in der Art kann man sich das vorstellen. Jetzt würde ich das ganze gerne in eine Header und in eine .cpp Datei unter VC++2005 aufteilen, nur wenn ich den Deklarationsteil in die cpp Datei packe, dann mault mir der Compiler vor</p>
<pre><code>fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include &quot;stdafx.h&quot;' to your source?
</code></pre>
<p>was mach ich denn falsch?</p>
<p>(in der cpp Datei include ich dann nur noch den Header)</p>
<p>Grüße Nils</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160991</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160991</guid><dc:creator><![CDATA[Nils_Langner]]></dc:creator><pubDate>Wed, 25 Oct 2006 12:56:30 GMT</pubDate></item><item><title><![CDATA[Reply to Source in Header und cpp aufteilen on Wed, 25 Oct 2006 13:00:01 GMT]]></title><description><![CDATA[<p>Du hast die vorkompilierte Headerdatei nicht ausgeschaltet, also musst du ganz zu Anfang in der cpp stdafx.h einbinden:</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &quot;meineHeader.h&quot;
</code></pre>
<p>Wenn du mal im Forum suchst solltest du auch fündig werden, wie man die vorkompilierte Header los wird (ich schalte sie grundsätzlich aus).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160993</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160993</guid><dc:creator><![CDATA[Vellas]]></dc:creator><pubDate>Wed, 25 Oct 2006 13:00:01 GMT</pubDate></item><item><title><![CDATA[Reply to Source in Header und cpp aufteilen on Wed, 25 Oct 2006 13:06:51 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#ifndef _SOPAS_USB_HOST_
#define _SOPAS_USB_HOST_

#include &quot;usbInterface.h&quot;;

class usbHost
{
	public:
						usbHost( );	
		int				getNumInterfaces( void );
		...
};

#endif // _SOPAS_USB_HOST_
</code></pre>
<p>Ok so sieht der Header jetzt aus, die cpp so:</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot; 
#include &quot;usbHost.h&quot;

#include &lt;setupapi.h&gt; 
extern &quot;C&quot; 
{ 
	#include &lt;hidsdi.h&gt; 
} 

bool usbHost::getUsbInterface( int number, usbInterface* usb_interface )
{	
	*usb_interface = foundUsbInterfaces[number];
	return ( number &lt;= numInterfaces );
}
</code></pre>
<p>aber irgendwie geht das trotzdem nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160995</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160995</guid><dc:creator><![CDATA[Nils_Langner]]></dc:creator><pubDate>Wed, 25 Oct 2006 13:06:51 GMT</pubDate></item><item><title><![CDATA[Reply to Source in Header und cpp aufteilen on Wed, 25 Oct 2006 13:14:23 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>schalte doch mal die &quot;precompiled header&quot; ab.<br />
Mir machen die auch mehr Probleme als sie positiv bringen.</p>
<p>Gruß,</p>
<p>Simon2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161002</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161002</guid><dc:creator><![CDATA[Simon2]]></dc:creator><pubDate>Wed, 25 Oct 2006 13:14:23 GMT</pubDate></item><item><title><![CDATA[Reply to Source in Header und cpp aufteilen on Wed, 25 Oct 2006 13:17:12 GMT]]></title><description><![CDATA[<p>Und &quot;geht nicht&quot; ist keine Fehlermeldung.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161005</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161005</guid><dc:creator><![CDATA[Vellas]]></dc:creator><pubDate>Wed, 25 Oct 2006 13:17:12 GMT</pubDate></item><item><title><![CDATA[Reply to Source in Header und cpp aufteilen on Wed, 25 Oct 2006 13:23:19 GMT]]></title><description><![CDATA[<p>Also die neuen Fehlermeldungen sind:</p>
<pre><code>1&gt;------ Build started: Project: USB Create File, Configuration: Debug Win32 ------
1&gt;Compiling...
1&gt;stdafx.cpp
1&gt;Compiling...
1&gt;USB Create File.cpp
1&gt;c:\dokumente und einstellungen\deagga-prakti-asw\desktop\langner\c++ projekte\usb create file\usb create file\usbinterface.h(45) : warning C4996: 
          'wcscpy' was declared deprecated
1&gt;        c:\programme\microsoft visual studio 8\vc\include\wchar.h(992) : see declaration of 'wcscpy'
1&gt;        Message: 'This function or variable may be unsafe. Consider using wcscpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1&gt;usbHost.cpp
1&gt;c:\winddk\3790.1830\inc\wxp\setupapi.h(56) : error C2143: syntax error : missing ';' before '*'
1&gt;c:\winddk\3790.1830\inc\wxp\setupapi.h(56) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1&gt;c:\winddk\3790.1830\inc\wxp\setupapi.h(56) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1&gt;c:\winddk\3790.1830\inc\wxp\commctrl.h(30) : error C2146: syntax error : missing ';' before identifier 'HRESULT'
1&gt;c:\winddk\3790.1830\inc\wxp\commctrl.h(30) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1&gt;c:\winddk\3790.1830\inc\wxp\commctrl.h(30) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1&gt;c:\winddk\3790.1830\inc\wxp\prsht.h(98) : error C2065: 'CALLBACK' : undeclared identifier
1&gt;c:\winddk\3790.1830\inc\wxp\prsht.h(98) : error C2065: 'LPFNPSPCALLBACKA' : undeclared identifier
1&gt;c:\winddk\3790.1830\inc\wxp\prsht.h(98) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1&gt;c:\winddk\3790.1830\inc\wxp\prsht.h(98) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1&gt;Build log was saved at &quot;file://c:\Dokumente und Einstellungen\DEAGga-prakti-asw\Desktop\Langner\C++ Projekte\USB Create File\USB Create File\Debug\BuildLog.htm&quot;
1&gt;USB Create File - 10 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
</code></pre>
<p>die bekomme ich auch, wenn ich precompiled headers ausschalte <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161006</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161006</guid><dc:creator><![CDATA[Nils_Langner]]></dc:creator><pubDate>Wed, 25 Oct 2006 13:23:19 GMT</pubDate></item><item><title><![CDATA[Reply to Source in Header und cpp aufteilen on Wed, 25 Oct 2006 13:38:54 GMT]]></title><description><![CDATA[<p>da sind irgendwelche Macros nicht definiert vermute ich mla<br />
muste mal schauen welche..unter windoof sind die Wichtigsten Macros:</p>
<pre><code>WINDOWS_LEAN_AND_MEAN
WIN32
_WIN32
WINNT (NT_VERSION)
</code></pre>
<p>Ich bin mir net 100% sicher ob das letzte richitg geschriebn ios. bite korrigiren wenn falsch.<br />
MfG Shade3737</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161011</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161011</guid><dc:creator><![CDATA[branleb]]></dc:creator><pubDate>Wed, 25 Oct 2006 13:38:54 GMT</pubDate></item></channel></rss>