I was wondering if anyone had successfully set up this library http://www.norgesgade14.dk/bluetoothlibrary.php in Visual Studio or Visual c++ Express. I have already used NXT++ with no problems however it lacks a lot of features.
It only mentions we need to add the files to our project, however it keeps returning different errors.
Could anyone provide a step-by-step guide on how to use it?
C++ NXT Bluetooth Library
-
- Posts: 224
- Joined: 30 Oct 2010, 04:10
- Location: 127.0.0.1
- Contact:
Re: C++ NXT Bluetooth Library
1. Download and extract
2. make a VC++ project
3. See my post here: https://sourceforge.net/apps/phpbb/mind ... ffel#p7160
4. Build
2. make a VC++ project
3. See my post here: https://sourceforge.net/apps/phpbb/mind ... ffel#p7160
4. Build
Commit to Lego Mindstorms StackExchange Q&A http://area51.stackexchange.com/proposals/4105
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
-
- Posts: 10
- Joined: 21 Oct 2011, 15:25
Re: C++ NXT Bluetooth Library
Ok, so i added the files to the project I created, but when compiling I get these errors:
]1>------ Build started: Project: NXT library, Configuration: Debug Win32 ------
1>Compiling...
1>bluetooth.cpp
1>c:\nxt c++ bluetooth library\bluetooth.cpp(42) : error C2664: 'CreateFileW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>main.cpp
1>c:\users\francis\documents\visual studio 2008\projects\nxt library\nxt library\main.cpp(5) : fatal error C1083: Cannot open include file: 'nxt.h': No such file or directory
1>Generating Code...
1>Build log was saved at "file://c:\Users\Francis\Documents\Visual Studio 2008\Projects\NXT library\NXT library\Debug\BuildLog.htm"
1>NXT library - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any ideas how to solve them?
]1>------ Build started: Project: NXT library, Configuration: Debug Win32 ------
1>Compiling...
1>bluetooth.cpp
1>c:\nxt c++ bluetooth library\bluetooth.cpp(42) : error C2664: 'CreateFileW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>main.cpp
1>c:\users\francis\documents\visual studio 2008\projects\nxt library\nxt library\main.cpp(5) : fatal error C1083: Cannot open include file: 'nxt.h': No such file or directory
1>Generating Code...
1>Build log was saved at "file://c:\Users\Francis\Documents\Visual Studio 2008\Projects\NXT library\NXT library\Debug\BuildLog.htm"
1>NXT library - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any ideas how to solve them?
-
- Posts: 224
- Joined: 30 Oct 2010, 04:10
- Location: 127.0.0.1
- Contact:
Re: C++ NXT Bluetooth Library
Use a cast to convert the char* to LPCWSTR
For the other error, is nxt.h in the same directory as main.cpp?
If not, add the folder to the VC++ include path.
For the other error, is nxt.h in the same directory as main.cpp?
If not, add the folder to the VC++ include path.
Commit to Lego Mindstorms StackExchange Q&A http://area51.stackexchange.com/proposals/4105
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
-
- Posts: 27
- Joined: 29 Sep 2010, 19:34
- Location: Denmark
- Contact:
Re: C++ NXT Bluetooth Library
That's not a good idea if it really is a char pointer. Either change the project to compile as ANSI instead of Unicode, or change the call to CreateFile() to use CreateFileA().timpattinson wrote:Use a cast to convert the char* to LPCWSTR
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests