I'm trying to build the gsl library on OS X. I got the gsl-1.0 from here.
I rand ./configure in the folder followed my make.
Once I ran make, I got this:
In file included from results.c:30:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include/varargs.h:25:4: error: "Please use <stdarg.h> instead of <varargs.h>"
#error "Please use <stdarg.h> instead of <varargs.h>"
^
results.c:70:7: warning: implicit declaration of function 'va_start' is invalid in C99 [-Wimplicit-function-declaration]
va_start (ap);
^
results.c:73:7: warning: implicit declaration of function 'va_end' is invalid in C99 [-Wimplicit-function-declaration]
va_end (ap);
^
2 warnings and 1 error generated.
make[2]: *** [results.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive-am] Error 2
I looked in the ...include/varargs.h file and found:
/*===---- varargs.h - Variable argument handling -------------------------------------===
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*===-----------------------------------------------------------------------===
*/
#ifndef __VARARGS_H
#define __VARARGS_H
#error "Please use <stdarg.h> instead of <varargs.h>"
#endif
Have I done something very wrong? Can I fix this?
Thanks in advance : )
Related
I just reinstalled MinGW and the Codelite IDE on my Windows PC, however I'm now unable to compile/build a project.
It is odd because every time I change a setting or make a new project, I am able to run it once, then it stops working.
I've already tried reinstalling MinGW...
This may be a bug of gcc that occurs when applying c++11 or newer standards, ie adding parameter "-std=c++11" or "-std=c++0x".
I fixed it by adding "#include "io.h"" in the file stdio.h.
you can go to your include path: "c:/mingw/include" and edit the "stdio.h".
/*
* stdio.h
*
* Definitions of types and prototypes of functions for operations on
* standard input and standard output streams.
*
* $Id: stdio.h,v 8863016e809f 2018/12/04 19:00:29 keith $
*
* Written by Colin Peters
* Copyright (C) 1997-2005, 2007-2010, 2014-2018, MinGW.org Project.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice, this permission notice, and the following
* disclaimer shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* NOTE: The file manipulation functions provided by Microsoft seem to
* work with either slash (/) or backslash () as the directory separator;
* (this is consistent with Microsoft's own documentation, on MSDN).
*
*/
#include //include at here
#ifndef _STDIO_H
#pragma GCC system_header
/* When including <wchar.h>, some of the definitions and declarations
* which are nominally provided in <stdio.h> must be duplicated. Rather
* than require duplicated maintenance effort, we provide for partial
* inclusion of <stdio.h> by <wchar.h>; only when not included in
* this partial fashion...
*/
If there is any problems or a better solution, i would appreciate your feedback very gladly.
I am studying Import Export Extension of Khronos openvx. while reading vx_import.h file I saw
VX_API_ENTRY vx_status VX_API_CALL vxReleaseImport(vx_import *import);
function.
I want to understand why they have written VX_API_ENTRY and VX_API_CALL in the function.
I am new to openvx. If anyone knows this please reply.
In the vx_types.h header you can read:
/*!
* \internal
* \def VX_API_ENTRY
* \brief This is a tag used to identify exported, public API functions as
* distinct from internal functions, helpers, and other non-public interfaces.
* It can optionally be defined in the make system according the the compiler and intent.
* \ingroup group_basic_features
*/
/*!
* \def VX_API_CALL
* \brief Defines calling convention for OpenVX API.
* \ingroup group_basic_features
*/
/*!
* \def VX_CALLBACK
* \brief Defines calling convention for user callbacks.
* \ingroup group_basic_features
*/
Then, VX_API_ENTRY is defined as empty and VX_API_CALL is defined __stdcall on Windows, and empty otherwise.
What are they for? Well, those are specifying the calling convention of the API, and at the same time, as the comment says, documenting which functions are actually public.
For example, in Windows, public functions from a DLL sometimes have declspec(__dllimport) prefixed to instruct the compiler to use the import function table, your build system can define VX_API_ENTRY for that.
The __stdcall thing is the calling convention used by this library. Usually you do not specify it and let the compiler choose the default. But in a public DLL it is a good idea not to rely to much on defaults, because the DLL compiler and the EXE compiler may use different values, and that would break the linking.
But mostly, as an end-user of the API you can just ignore them, they just work.
Except for VX_CALLBACK! You must declare your callbacks as VX_CALLBACK or you risk your code failing on some architectures (mainly Windows).
I would like to use GDB to break when an exception is thrown only when the stack goes through a specific function.
My use case is that I have a Thread class whose doRun() function is called in a new thread. That thread catches any exception that bubbles up, but I would like to be able to break when the exception is thrown (not caught).
I know GDB can do "reverse debugging" (awesome concept) so this could potentially be used, but I'd like something more general purpose -- in fact, I'd like this solution to find its way to my .gdbinit file.
Recent versions of gdb have some convenience functions that are useful for this, e.g., "$_any_caller_matches". These are written in Python, so even if your gdb doesn't have them built-in, you might be able to grab the code and just drop it into your gdb.
You would use it like (untested, but you get the idea):
catch throw if $_any_caller_matches("Thread::doRun")
It doesn't appear $caller_matches (or its sister function $caller_is) are included in the base installation of GDB.
Go ahead and add the source code into your GDB python functions folder.
This folder is usually found in /usr/share/gdb/python/gdb/function; the filename should be caller_is.py.
Note that when using $caller_matches, the underlying implementation is using re.match, so make sure the string you pass it works with that function.
As well, both functions have an optional second parameter, defaulting to 1, that specifies how far up the stack to traverse (look). This means that if you omit it, it will only check the direct caller of the current function. If you want to check specific stack positions (i.e. if you want to check the grandparent caller), use 2, 3, etc..
I've included the source below.
# Caller-is functions.
# Copyright (C) 2008 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import gdb
import re
class CallerIs (gdb.Function):
"""Return True if the calling function's name is equal to a string.
This function takes one or two arguments.
The first argument is the name of a function; if the calling function's
name is equal to this argument, this function returns True.
The optional second argument tells this function how many stack frames
to traverse to find the calling function. The default is 1."""
def __init__ (self):
super (CallerIs, self).__init__ ("caller_is")
def invoke (self, name, nframes = 1):
frame = gdb.selected_frame ()
while nframes > 0:
frame = frame.older ()
nframes = nframes - 1
return frame.name () == name.string ()
class CallerMatches (gdb.Function):
"""Return True if the calling function's name matches a string.
This function takes one or two arguments.
The first argument is a regular expression; if the calling function's
name is matched by this argument, this function returns True.
The optional second argument tells this function how many stack frames
to traverse to find the calling function. The default is 1."""
def __init__ (self):
super (CallerMatches, self).__init__ ("caller_matches")
def invoke (self, name, nframes = 1):
frame = gdb.selected_frame ()
while nframes > 0:
frame = frame.older ()
nframes = nframes - 1
return re.match (name.string (), frame.name ()) is not None
CallerIs()
CallerMatches()
The Doxygen documentation says that \ingroup can be used to add an entity to multiple groups:
\ingroup (<groupname> [<groupname> <groupname>])
The problem is that I tried it and Doxygen adds the entitiy to just the last group in the group list. Something like
/** \ingroup A B
* ...
*/
adds the element to module A, but not to B. Does anyone know why, and how to solve it?
I tried it with Doxygen versions 1.7.6.1 and 1.8.1.2.
Thanks for your help.
EDIT: I realized that doxygen outputs a warning that says:
Member X found in multiple #ingroup groups! The member will be put in group B, and not in group A
It seems to me that this is contradictory with the documentation.
ANSWER: I answer myself. I was trying to add functions to multiple groups, but the documentation says "Note that compound entities (like classes, files and namespaces) can be put into multiple groups, but members (like variable, functions, typedefs and enums) can only be a member of one group".
You usually (for allowed items, lets say a file) just need to write a ingroup with multiples group. Let me show, for completeness, a template I use:
/**
* \file
* \ingroup GrpTest GrpLicense
* \brief Here your brief explanation
* \details And you put here a more detailed explanation to the
* contents of the file.
* \version 1.0
* \date 2014-09-27
* \author Dr Beco
* \par Webpage
* <<http://www.program.pg/>>
* \copyright (c) 2014 GNU GPL v3
* \note This program is free software: you can redistribute it
* and/or modify it under the terms of the
* GNU General Public License as published by
* the Free Software Foundation version 3 of the License.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program.
* If not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA. 02111-1307, USA.
* Or read it online at <<http://www.gnu.org/licenses/>>.
*
*/
Now, from the Doxygen Documentation, specially the page linked here, you read:
Note that compound entities (like classes, files and namespaces)
can be put into multiple groups,
but members (like variable, functions, typedefs and enums)
can only be a member of one group
The documentation also explains why:
(this restriction is in place to avoid ambiguous linking
targets in case a member is not documented in the context
of its class, namespace or file, but only visible as part of a group).
So, for short, unfortunately you cannot add a function (or all kinds of entities, as you didn't specify, for that matter) to multiples groups.
I hope this link helps you with more questions you may have.
Use of
/** \ingroup A B
* ...
*/
will add the item to groups A and B only if they are defined elsewhere. If a group is not defined, it won't be defined just because it is used in an \ingroup command.
You should be able get the items in group B by using
/** \defgroup B
* #{
* #}
*/
/** \ingroup A B
* ...
*/
I'm using ffmpeg in my C++ application.
When trying to play certain files an assertion inside of ffmpeg fails, which causes it to call abort() which terminates my application. I do not want this behavior, rather I want to get the chance to recover, preferably through an exception.
Anyone got any ideas as to how I can get around the problem with ffmpeg/assert potentially terminating my application?
EDIT:
The only way I can think of right now is to change the ffmpeg assert macro so that it causes an access violation which I can catch through SEH exceptions. Ugly and potentially bad solution?
If the "exception" needs to be compiled as C, you could use a setjmp/longjump pair. Put the setjmp in your error handling code, and the longjmp in place of the abort in the FFMPG code.
If you really want a true exception to catch, a divide by zero might be safer than a random access violation.
This code is from ffmpeg doxygen documentation
/*
* copyright (c) 2010 Michael Niedermayer <michaelni#gmx.at>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_AVASSERT_H
#define AVUTIL_AVASSERT_H
#include <stdlib.h>
#include "avutil.h"
#include "log.h"
#define av_assert0(cond) do { \
if (!(cond)) { \
av_log(NULL, AV_LOG_FATAL, "Assertion %s failed at %s:%d\n", \
AV_STRINGIFY(cond), __FILE__, __LINE__); \
abort(); \
} \
} while (0)
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0
#define av_assert1(cond) av_assert0(cond)
#else
#define av_assert1(cond) ((void)0)
#endif
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
#define av_assert2(cond) av_assert0(cond)
#else
#define av_assert2(cond) ((void)0)
#endif
#endif /* AVUTIL_AVASSERT_H */
You could simply redefine the av_assert macros to throw instead of abort()
If you can't/don't want to re-work the ffmpeg code, then I'd say fork off another process to do the ffmpeg operations and then exit. You can wait for that process to exit one way or another in your main process and determine how it went, without risk of your main process being terminated.
It may not be the best solution in the world, but it gets you the isolation you need, with some hope of knowing what happened, and without having to do too much violence to the ffpmpeg code.