<?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[stdint.h Systaxfehler in typedef&#x27;s!]]></title><description><![CDATA[<p>Hallo,<br />
ich muß gleich sagen, daß ich kaum Ahnung hab von c oder c++. Aber ich muß aus einem C++ Code eine dll erzeugen, damit ich diese dann in ein <a href="http://vb.net" rel="nofollow">vb.net</a> Projekt einbinden kann.<br />
Ich habe mal eine Win32 erstellt und alle nötigen header files eingebunden. leider bekomm ichjede Menge (meist gleichartiger) Fehler wie z.b. bei der folgenden Zeilen:</p>
<pre><code class="language-cpp">typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
</code></pre>
<p>der Fehler lautet:</p>
<p>1&gt;c:\dokumente und einstellungen\ortalo\eigene dateien\visual studio 2008\projects\teensydll\teensydll\stdint.h(8) : error C2144: Syntaxfehler: 'int' sollte auf ';' folgen</p>
<p>Im header file inttypes.h sind die beiden Typen (int8_t und int16_t) aber definiert.</p>
<p>Kann mir hier jemand verraten, wo der Fehler liegt?</p>
<p>Vielen Dank im Voraus!<br />
Alois</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/264171/stdint-h-systaxfehler-in-typedef-s</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 04:59:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/264171.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 03 Apr 2010 15:37:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to stdint.h Systaxfehler in typedef&#x27;s! on Sat, 03 Apr 2010 15:37:05 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich muß gleich sagen, daß ich kaum Ahnung hab von c oder c++. Aber ich muß aus einem C++ Code eine dll erzeugen, damit ich diese dann in ein <a href="http://vb.net" rel="nofollow">vb.net</a> Projekt einbinden kann.<br />
Ich habe mal eine Win32 erstellt und alle nötigen header files eingebunden. leider bekomm ichjede Menge (meist gleichartiger) Fehler wie z.b. bei der folgenden Zeilen:</p>
<pre><code class="language-cpp">typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
</code></pre>
<p>der Fehler lautet:</p>
<p>1&gt;c:\dokumente und einstellungen\ortalo\eigene dateien\visual studio 2008\projects\teensydll\teensydll\stdint.h(8) : error C2144: Syntaxfehler: 'int' sollte auf ';' folgen</p>
<p>Im header file inttypes.h sind die beiden Typen (int8_t und int16_t) aber definiert.</p>
<p>Kann mir hier jemand verraten, wo der Fehler liegt?</p>
<p>Vielen Dank im Voraus!<br />
Alois</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1877168</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1877168</guid><dc:creator><![CDATA[ortech]]></dc:creator><pubDate>Sat, 03 Apr 2010 15:37:05 GMT</pubDate></item><item><title><![CDATA[Reply to stdint.h Systaxfehler in typedef&#x27;s! on Sat, 03 Apr 2010 15:38:40 GMT]]></title><description><![CDATA[<p>stdint.h benutzt man in C++ nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1877170</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1877170</guid><dc:creator><![CDATA[Janjan]]></dc:creator><pubDate>Sat, 03 Apr 2010 15:38:40 GMT</pubDate></item><item><title><![CDATA[Reply to stdint.h Systaxfehler in typedef&#x27;s! on Sat, 03 Apr 2010 15:58:09 GMT]]></title><description><![CDATA[<p>Janjan schrieb:</p>
<blockquote>
<p>stdint.h benutzt man in C++ nicht.</p>
</blockquote>
<p>Und wenn du endlich mal erklären würdest warum wären deine Antworten brauchbar und weniger arrogant... (sry musste mal sein).</p>
<p>stdint.h ist C.<br />
In C++ heißt das</p>
<pre><code class="language-cpp">#include &lt;cstdint&gt;
</code></pre>
<p>Aber ob das deinen Fehler bereinigt?<br />
Evtl. mal den fehlerhaften Code posten, wenns noch nicht hilft.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1877179</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1877179</guid><dc:creator><![CDATA[l&#x27;abra d&#x27;or]]></dc:creator><pubDate>Sat, 03 Apr 2010 15:58:09 GMT</pubDate></item><item><title><![CDATA[Reply to stdint.h Systaxfehler in typedef&#x27;s! on Sat, 03 Apr 2010 16:04:12 GMT]]></title><description><![CDATA[<p>l'abra d'or schrieb:</p>
<blockquote>
<p>Janjan schrieb:</p>
<blockquote>
<p>stdint.h benutzt man in C++ nicht.</p>
</blockquote>
<p>Und wenn du endlich mal erklären würdest warum wären deine Antworten brauchbar und weniger arrogant... (sry musste mal sein).</p>
</blockquote>
<p>Dann wären es aber nicht meine Antworten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1877181</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1877181</guid><dc:creator><![CDATA[Janjan]]></dc:creator><pubDate>Sat, 03 Apr 2010 16:04:12 GMT</pubDate></item><item><title><![CDATA[Reply to stdint.h Systaxfehler in typedef&#x27;s! on Sat, 03 Apr 2010 16:05:59 GMT]]></title><description><![CDATA[<p>l'abra d'or schrieb:</p>
<blockquote>
<p>In C++ heißt das</p>
<pre><code class="language-cpp">#include &lt;cstdint&gt;
</code></pre>
</blockquote>
<p>Nein, <code>&lt;cstdint&gt;</code> ist keine Headerdatei des C++-Standards.</p>
<p><code>&lt;stdint.h&gt;</code> ist ein Header von C99, den viele Standardbibliotheken mit sich bringen. Es gäbe auch noch <code>&lt;boost/cstdint.hpp&gt;</code> , falls man Boost benutzt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1877183</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1877183</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sat, 03 Apr 2010 16:05:59 GMT</pubDate></item><item><title><![CDATA[Reply to stdint.h Systaxfehler in typedef&#x27;s! on Sat, 03 Apr 2010 16:24:06 GMT]]></title><description><![CDATA[<p>Nexus schrieb:</p>
<blockquote>
<p>Nein, <code>&lt;cstdint&gt;</code> ist keine Headerdatei des C++-Standards.</p>
<p><code>&lt;stdint.h&gt;</code> ist ein Header von C99, den viele Standardbibliotheken mit sich bringen. Es gäbe auch noch <code>&lt;boost/cstdint.hpp&gt;</code> , falls man Boost benutzt.</p>
</blockquote>
<p>Jepp, habs auch grad gesehen.<br />
Im GCC gibt es allerdings ein cstdint, allerdings für C++0x. Scheinbar kommt das mit dem neuen Standard.<br />
Ansonsten liegt auch ein cstdint im tr1. Boost sollte es dann nicht brauchen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1877187</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1877187</guid><dc:creator><![CDATA[l&#x27;abra d&#x27;or]]></dc:creator><pubDate>Sat, 03 Apr 2010 16:24:06 GMT</pubDate></item><item><title><![CDATA[Reply to stdint.h Systaxfehler in typedef&#x27;s! on Sat, 03 Apr 2010 17:09:45 GMT]]></title><description><![CDATA[<p>Es handlet sich um folgenden Code, den ich als dll brauche, um ihn unter <a href="http://vb.net" rel="nofollow">vb.net</a> nutzen zu können:</p>
<pre><code class="language-cpp">// TeensyDLL.cpp : Definiert die exportierten Funktionen für die DLL-Anwendung.
//

#include &quot;stdafx.h&quot;

// Raw HID, Basic API
extern &quot;C&quot; __declspec(dllexport)typedef void rawhid_t;
extern &quot;C&quot; __declspec(dllexport)rawhid_t * rawhid_open_only1(int vid, int pid, int usage_page, int usage);
extern &quot;C&quot; __declspec(dllexport)int rawhid_status(rawhid_t *hid);
extern &quot;C&quot; __declspec(dllexport)int rawhid_read(rawhid_t *h, void *buf, int bufsize, int timeout_ms);
extern &quot;C&quot; __declspec(dllexport)int rawhid_write(rawhid_t *hid, const void *buf, int len, int timeout_ms);
extern &quot;C&quot; __declspec(dllexport)void rawhid_close(rawhid_t *h);

/* Raw HID I/O Routines
 * Copyright 2008, PJRC.COM, LLC
 * paul@pjrc.com
 *
 * You may redistribute this program and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses/
 */

// This code will someday be turned into &quot;librawhid&quot;, an easy-to-use
// and truly cross platform library for accessing HID reports.  But
// there are many complexities not properly handled by this simple
// code that would be expected from a high quality library.  In
// particular, how report IDs are handled is not uniform on the 3
// platforms.  The mac code uses a single buffer which assumes no
// other functions can cause the &quot;run loop&quot; to process HID callbacks.
// The linux version doesn't extract usage and usage page from the
// report descriptor and just hardcodes a signature for the Teensy
// USB debug example.  Lacking from all platforms are functions to
// manage multiple devices and robust detection of device removal
// and attachment.  There are probably lots of other issues... this
// code has really only been used in 2 projects.  If you use it,
// please report bugs to paul@pjrc.com

#include &lt;stdio.h&gt;
#include &quot;stdint.h&quot;
#include &lt;string.h&gt;
#include &quot;rawhid.h&quot;

#ifdef OPERATING_SYSTEM
#undef OPERATING_SYSTEM
#endif

/*************************************************************************/
/**                                                                     **/
/**                     Windows 2000/XP/Vista                           **/
/**                                                                     **/
/*************************************************************************/

#if (defined(WIN32) || defined(WINDOWS) || defined(__WINDOWS__)) &amp;&amp; !defined(OPERATING_SYSTEM)
#define OPERATING_SYSTEM windows
#include &quot;windows.h&quot;
#include &quot;setupapi.h&quot;
#include &quot;hidsdi.h&quot;
#include &quot;hidclass.h&quot;

// http://msdn.microsoft.com/en-us/library/ms790932.aspx

struct rawhid_struct {
	HANDLE handle;
};

rawhid_t * rawhid_open_only1(int vid, int pid, int usage_page, int usage)
{
	GUID guid;
	HDEVINFO info;
	DWORD index=0, required_size;
	SP_DEVICE_INTERFACE_DATA iface;
	SP_DEVICE_INTERFACE_DETAIL_DATA *details;
	HIDD_ATTRIBUTES attrib;
	PHIDP_PREPARSED_DATA hid_data;
	HIDP_CAPS capabilities;
	struct rawhid_struct *hid;
	HANDLE h;
	BOOL ret;

	HidD_GetHidGuid(&amp;guid);
	info = SetupDiGetClassDevs(&amp;guid, NULL, NULL,
		DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
	if (info == INVALID_HANDLE_VALUE) {
		printf(&quot;HID/win32: SetupDiGetClassDevs failed&quot;);
		return NULL;
	}
	for (index=0; ;index++) {
		iface.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
		ret = SetupDiEnumDeviceInterfaces(info, NULL, &amp;guid, index, &amp;iface);
		if (!ret) {
			// end of list
			SetupDiDestroyDeviceInfoList(info);
			return NULL;
		}
		SetupDiGetInterfaceDeviceDetail(info, &amp;iface, NULL, 0, &amp;required_size, NULL);
		details = (SP_DEVICE_INTERFACE_DETAIL_DATA *)malloc(required_size);
		if (details == NULL) continue;
		memset(details, 0, required_size);
		details-&gt;cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
		ret = SetupDiGetDeviceInterfaceDetail(info, &amp;iface, details,
			required_size, NULL, NULL);
		if (!ret) {
			free(details);
			continue;
		}
		h = CreateFile(details-&gt;DevicePath, GENERIC_READ|GENERIC_WRITE,
			FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
			FILE_FLAG_OVERLAPPED, NULL);
		free(details);
		if (h == INVALID_HANDLE_VALUE) continue;
		attrib.Size = sizeof(HIDD_ATTRIBUTES);
		ret = HidD_GetAttributes(h, &amp;attrib);
		if (!ret) {
			CloseHandle(h);
			continue;
		}
		//printf(&quot;HID/win32:   USB Device:\n&quot;);
		//printf(&quot;HID/win32:     vid =        0x%04X\n&quot;, (int)(attrib.VendorID));
		//printf(&quot;HID/win32:     pid =        0x%04X\n&quot;, (int)(attrib.ProductID));
		if (vid &gt; 0 &amp;&amp; vid != (int)(attrib.VendorID)) {
			CloseHandle(h);
			continue;
		}
		if (pid &gt; 0 &amp;&amp; pid != (int)(attrib.ProductID)) {
			CloseHandle(h);
			continue;
		}
		if (!HidD_GetPreparsedData(h, &amp;hid_data)) {
			printf(&quot;HID/win32: HidD_GetPreparsedData failed\n&quot;);
			CloseHandle(h);
			continue;
		}
		if (!HidP_GetCaps(hid_data, &amp;capabilities)) {
			printf(&quot;HID/win32: HidP_GetCaps failed\n&quot;);
			HidD_FreePreparsedData(hid_data);
			CloseHandle(h);
			continue;
		}
		//printf(&quot;HID/win32:     usage_page = 0x%04X\n&quot;, (int)(capabilities.UsagePage));
		//printf(&quot;HID/win32:     usage      = 0x%04X\n&quot;, (int)(capabilities.Usage));
		if (usage_page &gt; 0 &amp;&amp; usage_page != (int)(capabilities.UsagePage)) {
			HidD_FreePreparsedData(hid_data);
			CloseHandle(h);
			continue;
		}
		if (usage &gt; 0 &amp;&amp; usage != (int)(capabilities.Usage)) {
			HidD_FreePreparsedData(hid_data);
			CloseHandle(h);
			continue;
		}
		HidD_FreePreparsedData(hid_data);
		hid = (struct rawhid_struct *)malloc(sizeof(struct rawhid_struct));
		if (!hid) {
			CloseHandle(h);
			printf(&quot;HID/win32: Unable to get %d bytes&quot;, sizeof(struct rawhid_struct));
			continue;
		}
		hid-&gt;handle = h;
		return hid;
	}
}

int rawhid_status(rawhid_t *hid)
{
	PHIDP_PREPARSED_DATA hid_data;

	if (!hid) return -1;
	if (!HidD_GetPreparsedData(((struct rawhid_struct *)hid)-&gt;handle, &amp;hid_data)) {
		printf(&quot;HID/win32: HidD_GetPreparsedData failed, device assumed disconnected\n&quot;);
		return -1;
	}
	printf(&quot;HID/win32: HidD_GetPreparsedData ok, device still online :-)\n&quot;);
	HidD_FreePreparsedData(hid_data);
	return 0;
}

void rawhid_close(rawhid_t *hid)
{
	if (!hid) return;
	CloseHandle(((struct rawhid_struct *)hid)-&gt;handle);
	free(hid);
}

int rawhid_read(rawhid_t *h, void *buf, int bufsize, int timeout_ms)
{
	DWORD num=0, result;
	BOOL ret;
	OVERLAPPED ov;
	struct rawhid_struct *hid;
	int r;

	hid = (struct rawhid_struct *)h;
	if (!hid) return -1;

	memset(&amp;ov, 0, sizeof(OVERLAPPED));
	ov.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
	if (ov.hEvent == NULL) return -1;

	ret = ReadFile(hid-&gt;handle, buf, bufsize, &amp;num, &amp;ov);
	if (ret) {
		//printf(&quot;HID/win32:   read success (immediate)\n&quot;);
		r = num;
	} else {
		if (GetLastError() == ERROR_IO_PENDING) {
			result = WaitForSingleObject(ov.hEvent, timeout_ms);
			if (result == WAIT_OBJECT_0) {
				if (GetOverlappedResult(hid-&gt;handle, &amp;ov, &amp;num, FALSE)) {
					//printf(&quot;HID/win32:   read success (delayed)\n&quot;);
					r = num;
				} else {
					//printf(&quot;HID/win32:   read failure (delayed)\n&quot;);
					r = -1;
				}
			} else {
				//printf(&quot;HID/win32:   read timeout, %lx\n&quot;, result);
				CancelIo(hid-&gt;handle);
				r = 0;
			}
		} else {
			//printf(&quot;HID/win32:   read error (immediate)\n&quot;);
			r = -1;
		}
	}
	CloseHandle(ov.hEvent);
	return r;
}

int rawhid_write(rawhid_t *h, const void *buf, int len, int timeout_ms)
{
	DWORD num=0;
	BOOL ret;
	OVERLAPPED ov;
	struct rawhid_struct *hid;
	int r;

	hid = (struct rawhid_struct *)h;
	if (!hid) return -1;

	memset(&amp;ov, 0, sizeof(OVERLAPPED));
	ov.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
	if (ov.hEvent == NULL) return -1;

	// first byte is report ID, must be zero if report IDs not used
	ret = WriteFile(hid-&gt;handle, buf, len, &amp;num, &amp;ov);
	if (ret) {
		if (num == len) {
			//printf(&quot;HID/win32:   write success (immediate)\n&quot;);
			r = 0;
		} else {
			//printf(&quot;HID/win32:   partial write (immediate)\n&quot;);
			r = -1;
		}
	} else {
		if (GetLastError() == ERROR_IO_PENDING) {
			if (GetOverlappedResult(hid-&gt;handle, &amp;ov, &amp;num, TRUE)) {
				if (num == len) {
					//printf(&quot;HID/win32:   write success (delayed)\n&quot;);
					r = 0;
				} else {
					//printf(&quot;HID/win32:   partial write (delayed)\n&quot;);
					r = -1;
				}
			} else {
				//printf(&quot;HID/win32:   write error (delayed)\n&quot;);
				r = -1;
			}
		} else {
			//printf(&quot;HID/win32:   write error (immediate)\n&quot;);
			r = -1;
		}
	}
	CloseHandle(ov.hEvent);
	return r;
}

#endif // windows

#ifndef OPERATING_SYSTEM
#error Unknown operating system
#endif
</code></pre>
<p>Die ersten paar Zeilen ,diemit extern &quot;C&quot; beginnen, habe ich lt. einer Anleitung eingefügt; hoffe die stimmen. Nur kompilieren läßt er sich net.<br />
Könnte mir evt. jemand den Code so abändern, daß ich ihn benutzen kann?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1877196</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1877196</guid><dc:creator><![CDATA[ortech]]></dc:creator><pubDate>Sat, 03 Apr 2010 17:09:45 GMT</pubDate></item></channel></rss>