Error: token "#" is not valid in preprocessor expressions - mysql

Can anyone tell me what would be the cause of the error
/mysql_com.h:306:5: error: token # is not valid in preprocessor expressions
while this mysql_com.h file does not contain any #. So how can I fix this error.
I think it's similar to the error when we open windows edited file in linux, then at that time ^V appers. But in this case # is not anywhere in the file.
Thanks in advance. Looking for your kind response.

Looks like this sort of problem has been reported when a '.h.in' file is included at some point, instead of the usual '.h' header file (eg. this) - perhaps because of some missing files or misconfigured include paths?
As has been previously suggested, I'd try tracing things back through the definition of MYSQL_VERSION_ID and double check that the correct .h files and include paths are present on your machine.

You have to check what is stored in MYSQL_VERSION_ID. Go to the library file, where this constant defined having the syntax like below :-
#define MYSQL_VERSION_ID BLAH-BLAH
Try to resolve this BLAH-BLAH, because this definitely have some problem, that have "#" symbol.

Related

nsys says "please use the qdrep file instead" - huh?

I'm using NVIDIA Nsight Systems version 2019.5.2.16-b54ef97 with CUDA 10.2. I'm running:
nsys profile my_app --some --args=here
so, a plain-vanilla profiling with no funny business. And yet, I get, at the bottom of the output:
... etc. etc. ...
Saving report to file "/some/where/report1.qdrep"
Report file saved.
Please discard the qdstrm file and use the qdrep file instead.
Removed /some/where/report1.qdstrm as it was successfully imported.
Please use the qdrep file instead.
Why am I being told to discard files and use other files instead? Especially given how, eventually, only a single file is generated (a .qdrep file)?
I'm guessing some internal conversion utility is run, and the message is not really intended for me - or am I missing something?
It is just a logging, which is a little confusing though, and later it removes the *.qdstrm file for you automatically.

Perl Cannot Find/Reload File

I have a submit.html file that prints calculations done in a file called Observation.pm. Observation.pm exists in the folder called project. However, when the script runs, these error are printed:
Error during compilation of submit.html:Attempt to reload project/Observation.pm aborted.Compilation failed in require at submit.html line 67.
Line 67 in submit.html is:
use project::Observation.pm;
For some reason, it cannot find the Observation.pm file.
I have tried deleting and adding the Observation.pm file again. I've also tried using
use lib /path/name/to/project/;
in submit.html.
Any ideas on why this is happening or how to fix it? Let me know if I left out some vital info of the problem, wasn't sure what was relevant.
Try to use: Observation::Attempt instead of Atempt and also use path to the .pm file
When you use project::Observation;, Perl looks in #INC directories, if it finds an appropriate module.
In your case (use lib '/path/name/to/project';), this means it looks for a module named /path/name/to/project/project/Observation.pm.
Note the double .../project/project/.... So the correct search path must include /path/name/to instead, e.g.
use lib /path/name/to;
or if you want/need to keep use lib '/path/name/to/project';, say
use Observation;
instead.
Also note #ChrisTurner's comment, don't add the .pm extension.

X++ - Creating a CommaIO object

I have a simple question. When I create a CommaIO, it works but when I arrive to the 'if' statement, it doesn't go to inside the 'if'. The message 'blabla' is never printed. Nevertheless, the file name is correct and the path also. My csv files was saved in Excel with csv(comma delimited) extension. The file and directory are authorized in read mode
commaIO = new CommaIO(#"C:\\Users\\lbagno\\Documents\\SalesPrice.csv","r");
print "blabla";
pause;
print "fdf";
pause;
if(commaIO)
{
print "ici3";
pause;
}
Where is the problem ?
Thank you
When I first saw this I thought it was because you had \\ aswell as the # but seemingly in my code it works when I put it in a job.
Few questions.
try removing the \\ so it is just \ and see whether that fixes it (as I said it doesnt make a difference on mine)
Does the user running AX have access to that file path?
Does the file exist.
A few pointers for you, try using info("string") instead of print and pause, it's more standard and you dont have to pause every step.
Also commaIO has been superceeded by CommaTextIo. Looks like you can use the same code but I'm guessing it adds some functionality. http://msdn.microsoft.com/en-us/library/aa624902(v=ax.50).aspx
I can't comment on this post because of I don't have a high enough reputation so sorry if this isn't helpful as an answer.
Try moving the file to C:\Temp directory. It may be a permissions issue!!
The # makes it a string literal...so you're doing double \\ for no reason...but I think it still does work.
Use one of the two though:
CommaIo commaIO = new CommaIO(#"C:\Users\lbagno\Documents\SalesPrice.csv","r");
CommaIo commaIO = new CommaIO("C:\\Users\\lbagno\\Documents\\SalesPrice.csv","r");
Also, checking if (commaIo) will work if it finds a valid file, then you run while (commaIo.status() == IO_Status::Ok).
I'd say the issue is that either your file does not exist (as typed), it's a client/server issue, OR it's a permissions issue.
Start with a job and a local file.

'Statement Expected' Syntax Error Highlighting on First Line of JS File in PHPStorm

I have a JS file where no matter what is put on the first line (comment or code), PHPStorm lists a syntax error. When I hover over the error, the description says "Statement Expected". What it looks like:
Is this a bug with the IDE or something that can be disabled?
EDIT
Sample file here
You have UTF-8 BOM signature (EF BB BF) just before var myApp= line (first code line in that file)
If you remove it IDE will stop complaining.
P.S.
Yes -- IDE should be smarter in such case and should provide better error message and error location. Feel free to submit new ticket to the Issue Tracker at http://youtrack.jetbrains.com/issues/WI
In most of the cases this issue occurs due to copy paste.
There may be some characters/line feed which may need to rewrite in your IDE.
In such cases simply copy your code to notepad and again copy it back to your IDE.
You can turn off "Properties > Languages & Frameworks > Template Data Languages" and error "statement expected" will go out.

MATLAB error: Undefined function or method X for input arguments of type 'double' [duplicate]

This question already has answers here:
"Undefined function 'function_name' for input arguments of type 'double'."
(3 answers)
Closed 5 years ago.
I'm a new user of Matlab, can you please help:
I have the following code in an .M file:
function f = divrat(w, C)
S=sqrt(diag(diag(C)));
s=diag(S);
f=sqrt(w'*C*w)/(w'*s);
I have stored this file (divrat.M) in the normal Matlab path, and therefore I'm assuming that Matlab will read the function when it's starting and that this function therefore should be available to use.
However, when I type
>> divrat(w, C)
I get the following error
??? Undefined function or method 'divrat' for input arguments of type 'double'.
What is the error message telling me to do, I can't see any error in the code or the function call?
You get this error when the function isn't on the MATLAB path or in pwd.
First, make sure that you are able to find the function using:
>> which divrat
c:\work\divrat\divrat.m
If it returns:
>> which divrat
'divrat' not found.
It is not on the MATLAB path or in PWD.
Second, make sure that the directory that contains divrat is on the MATLAB path using the PATH command. It may be that a directory that you thought was on the path isn't actually on the path.
Finally, make sure you aren't using a "private" directory. If divrat is in a directory named private, it will be accessible by functions in the parent directory, but not from the MATLAB command line:
>> foo
ans =
1
>> divrat(1,1)
??? Undefined function or method 'divrat' for input arguments of type 'double'.
>> which -all divrat
c:\work\divrat\private\divrat.m % Private to divrat
As others have pointed out, this is very probably a problem with the path of the function file not being in Matlab's 'path'.
One easy way to verify this is to open your function in the Editor and press the F5 key. This would make the Editor try to run the file, and in case the file is not in path, it will prompt you with a message box. Choose Add to Path in that, and you must be fine to go.
One side note: at the end of the above process, Matlab command window will give an error saying arguments missing: obviously, we didn't provide any arguments when we tried to run from the editor. But from now on you can use the function from the command line giving the correct arguments.
The most common cause of this problem is that Matlab cannot find the file on it's search path. Basically, Matlab looks for files in:
The current directory (pwd);
Directly in a directory on the path (to see the path, type path at the command line)
In a directory named #(whatever the class of the first argument is) that is in any directory above.
As someone else suggested, you can use the command which, but that is often unhelpful in this case - it tells you Matlab can't find the file, which you knew already.
So the first thing to do is make sure the file is locatable on the path.
Next thing to do is make sure that the file that matlab is finding (use which) requires the same type as the first argument you are actually passing. I.el, If w is supposed to be different class, and there is a divrat function there, but w is actually empty, [], so matlab is looking for Double/divrat, when there is only a #(yourclass)/divrat. This is just speculation on my part, but this often bites me.
The function itself is valid matlab-code. The problem must be something else.
Try calling the function from within the directory it is located or add that directory to your searchpath using addpath('pathname').
The error code indicates the function definition cannot be found. Make sure you're calling the function from the same workspace as the divrat.m file is stored. And make sure divrat function is not a subfunction, it should be first function declaration in the file. You can also try to call the function from the same divrat.m file in order to see if the problem is with workspace selection or the function.
By the way, why didn't you simply say
s = sqrt(diag(C));
Wouldn't it be the same?
Also, name it divrat.m, not divrat.M. This shouldn't matter on most OSes, but who knows...
You can also test whether matlab can find a function by using the which command, i.e.
which divrat
I am pretty sure that the reason why this problem happened is because of the license of the toolbox (package) in which this function belongs in. Write which divrat and see what will be the result. If it returns path of the function and the comment Has no license available, then the problem is related to the license. That means, license of the package is not set correctly. Mostly it happens if the package (toolbox) of this function is added later, i.e., after installation of the original matlab. Please check and solve the license issue, then it will work fine.