4

I have a problem including a library to my C++ project. The library is written by collegues but when I try to include it in my project I get a whole bunch of error: stray character in program, namely these:

||=== Build: Debug in WindowsDgps (compiler: GNU GCC Compiler) ===|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\220' in program|
..\WindowsAPI\VibroTacLib.dll|1|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\3' in program|
..\WindowsAPI\VibroTacLib.dll|1|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\4' in program|
..\WindowsAPI\VibroTacLib.dll|1|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\377' in program|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\377' in program|
..\WindowsAPI\VibroTacLib.dll|1|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\270' in program|
..\WindowsAPI\VibroTacLib.dll|1|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '@' in program|
..\WindowsAPI\VibroTacLib.dll|1|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\200' in program|
..\WindowsAPI\VibroTacLib.dll|1|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\16' in program|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\37' in program|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\272' in program|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\16' in program|
..\WindowsAPI\VibroTacLib.dll|1|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\264' in program|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\315' in program|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\270' in program|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\1' in program|
..\WindowsAPI\VibroTacLib.dll|1|error: stray '\315' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\1' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\272' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\340' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\16' in program|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '#' in program|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\1' in program|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\2' in program|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\26' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\7' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\10' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '`' in program|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\20' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\20' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\220' in program|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\7' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\24' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\20' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\2' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\4' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\1' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\4' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\4' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\375' in program|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\27' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\3' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\20' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\20' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\20' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\20' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\260' in program|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\10' in program|
..\WindowsAPI\VibroTacLib.dll|3|warning: null character(s) ignored [enabled by default]|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\17' in program|
..\WindowsAPI\VibroTacLib.dll|3|error: stray '\5' in program|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 35 warning(s) (4 minute(s), 50 second(s)) ===|

I figure this is because the library is encoded in a different way than my project, after finding several similar questions that had this error inside of the self written program. Could anyone tell me how to fix this problem? Maybe I included the library wrongly, I use Code::Blocks software and clicked "Build options" on my project, and in the Linker settings tab I included ..\WindowsAPI\libVibroTacLib.a in the Link libraries window. The #include part in my main.cpp looks like this:

#include "VibroTac.h"
#include "errorcodes.h"
#include "vibroTacTypeDef.h"
#include "VibroTacLib.dll"
Lehue
  • 425
  • 8
  • 26
  • Maybe this one helps http://stackoverflow.com/q/17222397/1741542. The second answer suggests the files encoded in some 16bit Unicode. – Olaf Dietsche Oct 19 '16 at 09:13
  • Another one http://stackoverflow.com/q/19149060/1741542 – Olaf Dietsche Oct 19 '16 at 09:15
  • @Olaf thank you for that. Though I don't quite understand what file I have to open because I cannot open a .dll file, can I? I tried with PSPadEditor... – Lehue Oct 19 '16 at 09:18
  • 1
    *If* the source file is encoded in UTF-16, every character occupies two bytes instead of one. This would explain the "warning: null character(s) ignored". – Olaf Dietsche Oct 19 '16 at 09:21
  • 1
    A DLL is not a source code file to be compiled. It's the end product. Don't try to compile the DLL. – Cheers and hth. - Alf Oct 19 '16 at 09:23
  • 2
    I overlooked your final `#include "VibroTacLib.dll"`. This is explained in the second question, I mentioned. Remove this line, and you might be done. – Olaf Dietsche Oct 19 '16 at 09:23
  • @Olaf when I remove the mentioned line the problem is, that the functions I call are not implemented...At least I get this error code from `errorcodes.h`. That is why I thought I would have to include the .dll as well... – Lehue Oct 19 '16 at 09:27
  • Nevertheless, keep the line removed. When you get other error messages, you must figure out, what to include. Search for the missing function/method/variable names in the header files `*.h` and include these. – Olaf Dietsche Oct 19 '16 at 09:30
  • Sorry to ask another stupid question @Olaf, but do you know how I should include these missing functions? For example the `vibroTac.connect()` looks like this in the `*.h` file: `virtual int CALL connect(const char* port);`. Any idea on how to implement this? – Lehue Oct 19 '16 at 10:10
  • I can't tell, because I don't know this vibrotac library. If this method is already in the library, you must add it to the list of libraries used by your program. If this is a method supposed to be implemented by a derived class, you must create a new class inheriting from the base class, see [virtual function specifier](http://en.cppreference.com/w/cpp/language/virtual) for a simple example. – Olaf Dietsche Oct 19 '16 at 10:27
  • @Olaf thank you for your help. It turned out the author of this library capsulatet its functionality. With another way to call the functions it works. – Lehue Oct 19 '16 at 10:49

0 Answers0