So I am using Visual Studio 2015 and some online library I found,and in the sample project everything is working, but when i make my own, I get errors.
Errors are found in file cmath.
When i build my project i get
'abs' , 'pow' , 'abs' , 'acos' , ..., second C linkage of overloaded function not allowed.
How can i fix this ? I tried setting
Properties->General->Project Defaults -> Character set to Use Multi-Byte Character Set or No set, but still get errors.
Thanks !
Note 1:
It looks like inside file cmath there are two functions of each mathematical function that make problem like:
_Check_return_ inline double abs(_In_ double _Xx) _NOEXCEPT
{
return (_CSTD fabs(_Xx));
}
_Check_return_ inline float abs(_In_ float _Xx) _NOEXCEPT
{
return (_CSTD fabsf(_Xx));
}
Why are there two of these functions and why would this represent a problem ?
File was .cpp and library was for C. So this made some errors, after changing extension of file to .c errors dissapeared
Related
I am using Inno Download Plugin to download a bunch of files for my installation. These files are listed in "files.json".
FileList := TStringList.Create;
FileList.LoadFromFile(ExpandConstant('{tmp}\files.json'));
for i := 0 to FileList.Count-1 do
begin
fileName := ExtractFileName(FileList[i]);
StringChangeEx(FileList[i], '\', '/',True);
//Add each file to download queque
idpAddFile("www.myapiaddress.com/files/" + FileList[i], ExpandConstant('{tmp}\install\') + fileName );
Log(FileList[i]);
end;
What gives me a headache is the line StringChangeEx(FileList[i], '\', '/',True). As soon as I put that in, the idp.iss stops compiling, giving me the error: Variable expected on
procedure idpAddFile(url, filename: String); external 'idpAddFile#files:idp.dll cdecl';
Installer compiles normal, if I remove StringChangeEx from my script entirely. It does not help to place it in a different location...
Any idea, what might cause this problem?
The StringChangeEx function needs a string variable in the first argument (it's declared as var). You are giving it a string value only.
Your code would work, were FileList a string array. But it's not, it's a class with an array-like string default property. Using a property value is an equivalent of using a function/method return value. A property is just syntactic sugar for getter and setter methods.
You will have to copy the value to a string variable and back.
S := FileList[i];
StringChangeEx(S, '\', '/',True);
FileList[i] := S;
Though you actually do not need to copy it back in your case.
Regarding the reason why the error refers to idp.iss file: There seems to be a bug in Inno Setup that makes it report the error as if it had occurred on the very first line of the Pascal Script code (what in your case is the very first real code in the included idp.iss). I've posted a bug report. It was fixed already.
Using ModelSim and VUnit I try to compile some UVVM, but this gives some warnings like:
** Warning: C:\work\Qtec\SVN_sim\Design\uvvm\uvvm_util\src\methods_pkg.vhd(1159): (vcom-1346) Default expression of interface object is not globally static.
So I would like to suppress these warnings, so I tried updating the VUnit "run.py" file with add_compile_option based on VUnit Python Interface:
uvvm_util = prj.add_library('uvvm_util')
uvvm_util.add_source_files(join(root, '../../uvvm/uvvm_util/src/*.vhd'))
uvvm_util.add_compile_option('modelsim.vcom_flags', ['-suppress 1346'])
But when compiling, I then get the error:
Compiling ....\uvvm\uvvm_util\src\types_pkg.vhd into uvvm_util ...
** Error (suppressible): (vcom-1902) Option "-suppress 1346" is either unknown, requires an argument, or was given with a bad argument.
You could edit the suppress entry in the modelsim.ini file. source
It could be a python/TCL error with spaces. See this link.
So the space between -suppress and 1346 is not properly forwarded.
The VUnit ui.py shows
modelsim.vcom_flags
Extra arguments passed to ModelSim vcom command.
Must be a list of strings.
I cannot test it, but this case the line should possibly be:
uvvm_util.add_compile_option('modelsim.vcom_flags', ['-suppress', '1346'])
edit: after some reading... To me the difference between add_compile_option and set_compile_option is not clear. Maybe you could try the other?
I'm trying to use the READFITS() function on IDL 8.3 on Mac 10.9.3
My input on the IDL promt:
readfits('image.fits',h, /EXTEN, /SILENT)
Result:
readfits('image.fits',h, /EXTEN, /SILENT)
^
% Syntax error.
*note: the '^' is below '/EXTEN'
Maybe it will help, so here is a link to the IDL help page on using READFITS() --> http://www.exelisvis.com/docs/readfits.html
I tried using the brackets like they show on that help page, but it still didn't work, so I'm stuck now. Didn't know if anyone here has experience reading .fits files in IDL.
ok, so it turns out the readfits procedure isn't included in IDL's original library, so I just had to download AstroLib (contains lots of useful astronomy procedures - including Readfits). The original syntax then worked.
I'm using IDL 8.2.2 on OS X 10.9.4.
Try keeping it simple first. Do these work?
readfits('image.fits')
readfits('image.fits', header)
Next try this:
readfits('image.fits', header, EXTEN_NO=0)
I suspect you really want extension number 0, not 1. See (e.g.) http://www.stsci.edu/documents/dhb/web/c02_datafiles.fm2.html.
I am trying to compile PHP on my Mac OS X 10.8 and I am getting the following problem:
In file included from /Users/ryan/Downloads/php-5.4.5/ext/phar/util.c:23:
ext/phar/phar_internal.h:223:19: error: invalid token at start of a preprocessor
expression
# if SIZEOF_SHORT == 2
^
I'm not sure why this error is occurring as this looks fine to me. I have opened the header file and could make changes if not or remove the if all together as I know what my system should be, but I was wondering if this is the proper approach to this problem.
It looks like SIZEOF_SHORT expands to no tokens. You should investigate where SIZEOF_SHORT is being #defined (this may be on the command line via -DSIZEOF_SHORT=) and fix that to provide the right value.
Alternatively, you could use this:
#include "limits.h"
/* ... */
#if SHRT_BIT == CHAR_BIT * 2
I didn't really find a solution to this problem, but I removed the if's and left behind the line that would be processed anyway and the program compiled just fine. I really don't know what was wrong with this file.
I'm using MSVC++ to program a simple window, and I included a resource file for a menu along the lines of:
MYMENU MENU DISCARDABLE
//etc.
and I created a header file "resourcedef.h" with definitions like
#define ID_MYMENU_FILE_CLOSE 1002
I can include it in my main.cpp file without error, however, when I include it in the resource file, I get the error
.\resourcedef.h(9) : fatal error RC1004: unexpected end of file found
(resourcedef.h is exactly 9 lines long). When I add a newline the the end of the .h,
//lines 1 - 8
#define ID_MYMENU_FILE_OPEN 1001
So that there is a tenth blank line (that doesn't appear on SO), it compiles fine. If I put anything on the tenth line, even a comment, the compiler gives me an error. Does anyone know what causes this and how I can fix it?
It's a bad idea to omit the trailing newline at the end of a text file - there are many tools that will fail to work properly unless it's there. (Some text editors will even warn you that's it's missing.)
Trailing newlines are standard behaviour for text files - why not go with the flow and just put one there. Everybody else does. 8-)
Long ago, MSVC++ at version 2 or so (1994-ish) would not handle "partial" lines at the end of the file properly. For example:
header.h
#ifndef __HEADER_H
#define __HEADER_H
void foo();
#endif // <-- no newline here
main.cpp
#include "header.h"
#include "other.h"
In this situation, the preprocessor would see the following text after resolving includes:
#ifndef __HEADER_H
#define __HEADER_H
void foo();
#endif#include "other.h"
The bug was that the last line would run together as shown above, and the "other.h" file would not be included. With the IDE at that time, it was easy to accidentally create a file with no trailing newline and run into the above situation.
Fortunately, this bug has long since been fixed. It looks like you've found one of the situations where the compiler warns that it doesn't expect to encounter the end of the file in the middle of a line. This is generally regarded as a good thing.