MATLAB and NI 2954R - c++

I have a Mex file which i want to use to interface with a hardware device called USRP NI2954R. I want to compile the MEX file but there are many errors.
The following is the part where i experience error:
#include "mex.h"
static uhd::usrp::multi_usrp::sptr[] usrp;
static boost :: mutex messages_mutex ;
The errors:
error C2653: 'uhd' : is not a class or namespace name
error C2146: syntax error : missing ';' before identifier 'usrp'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2133: 'sptr' : unknown size
And there are more, generally on similar lines for the boost line of the code

Related

Visual Studio 2019 has errors in built-in libraries

First time asking here, so please bear with me, or just let me know if I should do anything different.
I just installed a fresh version of Visual Studio 2019 and am trying to build a very basic C++ console application which includes Windows.h and iostream. Upon trying to build, I encounter over 100 build errors from the libraries that come with the IDE. Build output is shown below. Might anyone have a clue as to why the libraries that ship with VS2019 might cause so many build errors on their own?
Before you suggest Google and looking through other questions ashed here, I've searched in both places as well as Microsoft's knowledge base and have not been able to come across any relevant results. Thanks!
x32control.cpp:
#include "common.h"
int main ()
{
return errAndDie ("\nTesting errAndDie.\n\n");
}
common.cpp:
#include <iostream>
#include <winddi.h>
int errAndDie (const char* errorMessage) {
std::cout << errorMessage;
return -1;
common.h:
#ifndef COMMON_H
#define COMMON_H
#include <iostream>
#include <Windows.h>
int errAndDie (const char *errorMessage);
#endif
Errors:
1>common.cpp
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(90,22): error C3646: 'Data1': unknown override specifier
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(90,22): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(91,22): error C3646: 'Data2': unknown override specifier
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(91,22): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(92,22): error C3646: 'Data3': unknown override specifier
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(92,22): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(93,22): error C3646: 'Data4': unknown override specifier
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(93,22): error C2143: syntax error: missing ',' before '['
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(93,25): error C2143: syntax error: missing ')' before ';'
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(93,25): error C2238: unexpected token(s) preceding ';'
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddrawint.h(32,1): error C2146: syntax error: missing ';' before identifier 'GUID_MiscellaneousCallbacks'
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddrawint.h(32,122): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddrawint.h(33,1): error C2146: syntax error: missing ';' before identifier 'GUID_Miscellaneous2Callbacks'
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddrawint.h(33,124): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddrawint.h(34,1): error C2146: syntax error: missing ';' before identifier 'GUID_VideoPortCallbacks'
...
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddraw.h(296,44): error C3646: 'lpDDSZBufferSrc': unknown override specifier
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddraw.h(296,44): fatal error C1003: error count exceeds 100; stopping compilation
1>httpserver.cpp
1>x32control.cpp
1>Generating Code...
1>Done building project "x32control.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have found the issue. Including winddi.h in common.cpp was the issue. I'm not entirely sure how that got in there, as I do not recall ever typing that and I don't copy/paste often. My apologies for not noticing this ahead of posting. Sometimes new contexts make it easier to see these things.

I'm trying to add an external library to a Source mod, and I'm having some trouble

I'm trying to add this Serial Communications library to the Source SDK code to try to integrate my own serial input into Steam games. I've got the example projects on the Serial library I downloaded working fine. I added the Serial project to the Source solution and gave the "Server (HL2)" project a dependency to it (I'm using Visual Studio 2013 Express). I then went to my .cpp file under the Server (HL2) project and simply added
#include "Serial.h"
#define STRICT
#include <tchar.h>
#include <stdio.h>
#include <string.h>
which are the headers defined in the example project that was working for me, and got a lot of errors when I went to compile. The errors are all along the lines of:
\serial.h(190): error C2065: 'CE_RXOVER' : undeclared identifier
\serial.h(191): error C2065: 'CE_RXPARITY' : undeclared identifier
\serial.h(193): error C2065: 'CE_TXFULL' : undeclared identifier
\serial.h(215): error C2061: syntax error : identifier 'LPCTSTR'
\serial.h(220): error C2146: syntax error : missing ';' before identifier 'Open'
\serial.h(220): error C2433: 'CSerial::LONG' : 'virtual' not permitted on data declarations
\serial.h(220): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\serial.h(220): error C2061: syntax error : identifier 'LPCTSTR'
\serial.h(220): warning C4183: 'Open': missing return type; assumed to be a member function returning 'int'
\serial.h(223): error C2146: syntax error : missing ';' before identifier 'Close'
\serial.h(223): error C2433: 'CSerial::LONG' : 'virtual' not permitted on data declarations
\serial.h(223): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\serial.h(223): warning C4183: 'Close': missing return type; assumed to be a member function returning 'int'
\serial.h(241): error C2146: syntax error : missing ';' before identifier 'Setup'
\serial.h(241): error C2433: 'CSerial::LONG' : 'virtual' not permitted on data declarations
\serial.h(241): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\serial.h(244): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\serial.h(244): warning C4183: 'Setup': missing return type; assumed to be a member function returning 'int'
\serial.h(250): error C2146: syntax error : missing ';' before identifier 'SetEventChar'
\serial.h(250): error C2433: 'CSerial::LONG' : 'virtual' not permitted on data declarations
They repeat and then...
\serial.h(361): error C2061: syntax error : identifier 'LPOVERLAPPED'
\serial.h(329): error C2065: 'm_lLastError' : undeclared identifier
\serial.h(345): error C2065: 'DCBlength' : undeclared identifier
\serial.h(345): error C2065: 'DCB' : undeclared identifier
\serial.h(345): error C2070: 'unknown-type': illegal sizeof operand
There's also a whole lot more "undeclared identifiers" where that came from. I feel like there's a very obvious solution somewhere, either the way I have the solution set up or the linker or something. But it finds the file, it's just not interpreting it correctly it seems. When I take out
#include "Serial.h"
It compiles fine, so it has something to do with the way I'm adding that new header file. Any help would be much appreciated.

How to fix compile errors when including emscripten headers?

I'm trying to use emscripten Embind to bind C++ functions to JavaScript. Unfortunately I already get compile errors when including the specific header file with #include <emscripten/bind.h>.
I checked my emscripten environment and set an additonal Include Directory in VS2013 to the absolute path of the installation folder (also tried $(EMSCRIPTEN); and adapted the inlcude statement).
When compiling my project, I get 20+ compile errors:
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(24): error C2144: syntax error : 'bool' should be preceded by ';'
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(39): error C2146: syntax error : missing ';' before identifier 'TYPEID'
17> d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(42) : see reference to class template instantiation 'emscripten::internal::CanonicalizedID<T>' being compiled
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(54): error C2146: syntax error : missing ';' before identifier 'TYPEID'
...
I tried emscripten 1.22.0 and 1.25.0 and verified my emscripten environment following those instructions. What am I missing?
As far as I know, of the MS Visual Studio editions, only VS2010 is supported in Emscripten.
http://kripken.github.io/emscripten-site/docs/getting_started/getting_started_with_emscripten_and_vs2010.html#getting-started-emscripten-from-visual-studio

Winbase.h doesn't support in creating DLL file

I would like to create a project use to call c++ method using c#. So, I need to create a dll file for all of my c++ function. But when i get an error in y sqlite source code such as "AreFileApisASNSI undeclared identifier". So, i import winbase.h which is part of the mingw-w64 runtime package to my visual studio 2012 express DLL project. After import the file, I get many errors such as below:-
error c4430: missing type specifier - int assumed. Note: C++ does not support default - int
error C2143: syntax error : missing ';' before '_stdcall'
error c1003 error count exceeds 100; stopping compilation
error c2061: syntax error: identifier ' WINBOOL'
error c2086: 'int_CRT_INLINE' : redefinition
error c2143: syntax error: missing ';' before ''
error C2146: syntax error : missing ';' before identifier 'LONGLONG'
error C2146: syntax error : missing ';' before identifier 'PVOID'
any solution for those error? please help!!
The documentation for the function has this header requirement:
WinBase.h (include Windows.h)
This is telling you that the function is declared in WinBase.h, but that you should include Windows.h which in turn will include WinBase.h. So, you need to change your include to
#include <Windows.h>
I also wonder why you are talking about mingw considering that your compiler is MSVC. That compiler ships with a comprehensive Windows SDK. Why would you be using an SDK from mingw?

Compiling MySQL custom engine in Visual Studio 2008

I have compilation errors while compiling MySQL sample of storage engine from MySQL 5.1.36 sources. Looks to me that I set all paths to include subdirectories but that seems not enough.
Here are the errors:
1>c:\users\roman\desktop\mysql-5.1.36\sql\field.h(1455) : error C2065: 'FRM_VER' : undeclared identifier
1>c:\users\roman\desktop\mysql-5.1.36\sql\item_cmpfunc.h(1395) : error C2146: syntax error : missing ';' before identifier 'preg'
1>c:\users\roman\desktop\mysql-5.1.36\sql\item_cmpfunc.h(1395) : error C4430: missing type specifier
- int assumed. Note: C++ does not support default-int
1>c:\users\roman\desktop\mysql-5.1.36\sql\item_cmpfunc.h(1395) : error C4430: missing type specifier
- int assumed. Note: C++ does not support default-int
I had to include mysql_version.h.in library that contain all appropriate variables like FRM_VER, etc. That resolved the errors metioned above.