CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Jul 2020
    Posts
    32

    header files online database

    I would like to run quite old C code which requires file headers as follows:

    #include "nrutil.h
    #include "nr.h"
    #include "general.h"
    #include "other.h"
    #include "memory.h"
    #include "experimental.h"
    #include "corrinfo.h"

    Is there any good online database where I could download such files from?
    Thank you.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: header files online database

    I quick internet search for the first one shows it is available from codeforge

    headers such as general.h, other.h are likely to be specific to a particular program. I doubt these are available elsewhere.

    memory.h is too generic a name to know to which it refers. There is memory.h as part of LLVM - but that's c++ code.

    If you have the c code, aren't the headers available as well?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    Join Date
    Jul 2020
    Posts
    32

    Re: header files online database

    Thank you for your last post, I managed to get the complete code with its original header files from the authors.

    Could I ask you to recover that attached C code, it was written about 20years ago in environment I do not know. It produces many errors in MSVC2019. I would prefer to have it running in modern environment, I hope it will not be a huge problem to remove these, I believe, simple errors. The main file is corrinfo.c. If possible, could you pls write a short comments how the errors were removed, I would like to learn how to remove such errors
    Thank you very much for your help.

    -----------------------------
    The software we worked at the summer (cmath/gsl) is successfully analysing the data all the time now.
    Attached Files Attached Files

  4. #4
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: header files online database

    The header files are just that - headers. They don't have the associated source code for the declared functions (ie for the functions declared in nrutil.h). To get this code to compile you either need the code for these functions (eg nrutil.c)- or correct import .lib file(s).
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  5. #5
    Join Date
    Oct 2020
    Posts
    6

    Re: header files online database

    Lots of errors. Many undefined types: What is "vector" in pure C code for example?

  6. #6
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: header files online database

    vector is a C++ container. If you have reference to a vector in C code, then you'll need to obtain the definition as it probably won't be the same/have the same interface as the C++ one.

    You could probably reverse engineer one from its usage - but that's not a minor thing to do.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  7. #7
    Join Date
    Oct 2020
    Posts
    6

    Re: header files online database

    Quote Originally Posted by 2kaud View Post
    vector is a C++ container
    Yes, undefined in pure C code as I said/asked.

  8. #8
    Join Date
    Jul 2020
    Posts
    32

    variable visualisation in MSVC2019 debugger

    A question regarding visualisation of matrices in the MSVC2019 debugger.
    Attached Files Attached Files

  9. #9
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: variable visualisation in MSVC2019 debugger

    Quote Originally Posted by arek___ View Post
    A question regarding visualisation of matrices in the MSVC2019 debugger.
    Post your question directly.

  10. #10
    Join Date
    Jul 2020
    Posts
    32

    Re: variable visualisation in MSVC2019 debugger

    Quote Originally Posted by Arjay View Post
    Post your question directly.
    Could you pls let me know what you meant by 'Post your question directly'. Thanks.

  11. #11
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: variable visualisation in MSVC2019 debugger

    Quote Originally Posted by arek___ View Post
    Could you pls let me know what you meant by 'Post your question directly'. Thanks.
    Very simple: you should ask your questions directly in the forum posts, not in some attachments that have to be downloaded just to read what you meant.
    The same is valid for the (not too long) code snippets.
    Victor Nijegorodov

  12. #12
    Join Date
    Jul 2020
    Posts
    32

    Re: variable visualisation in MSVC2019 debugger

    Hi,

    I would have a technical question regarding MSVC2019.
    I got a code written by someone else and would like, step by step, to follow i.e. to see how every variable is manipulated along the code to understand the mathematical transformations.
    Of course, it is possible, in very limited way, to watch the single variables in ‘Locals’, but not matrices.
    But, I would like to be able to display e.g. the whole data matrix after each single manipulation e.g. after execution of every ‘for’ loop iteration. Is it possible to have a proper access to processed variables or matrices?

    Below is the beginning of the software, line 14 corresponds to function: main()
    The software gets input variable ‘const mxArray *prhs[]’
    In ‘Locals’ we can only see the pointer to ‘const mxArray *prhs[]’, but cannot see the whole content of it.

    --- file_01.jpg ---

    Or, later, variable ‘mxbinned’ in line 55 contains matrix [40x8], which I cannot see in ‘Locals’, I can only see pointer to this matrix. And so on for all other manipulated matrices in the code/debugger.

    --- file_02.jpg ---

    I found online that in the past 'Array Visualizer' from https://marketplace.visualstudio.com...rrayVisualizer
    was able to present the variables/matrices, but it was stopped some time ago.
    Could you pls advise how to sort this problem out, simply to be able to see matrices or whole variables (of course with reasonable sizes) in e.g. the debugger .

    Thank you.
    Attached Images Attached Images   

  13. #13
    Join Date
    Jul 2020
    Posts
    32

    Re: variable visualisation in MSVC2019 debugger

    Hi,
    Could I ask for help to add to the attached code some extra instructions displaying some variables on the screen in Console or enabling in any other way to see whole variables like: mxbinned, P_vec, P_total, binned, cond_hist (maybe saved in form of files on HDD).
    Thanks
    Attached Files Attached Files

  14. #14
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: header files online database

    You could add some TRACE macros to output the variable contents (it will be shown in Output/Debug window.
    Or/And you could type in the local variable name (or just drag/drop the variable identificator) into the Watch window and see its current value there.
    Victor Nijegorodov

  15. #15
    Join Date
    Jul 2020
    Posts
    32

    Re: header files online database

    Thank you for your reply. I am not a professional C programmer. Could you pls help me to write that macro and place it in the code ?

    I also tried two other solutions, line 70 or line 71 in attached code:
    The ‘printf’ function does not create the console.
    printf("The content at %d is %d\n", m, (int*)mxbinned);

    The ‘cout’ function produces error:
    Building with 'Microsoft Visual C++ 2019 (C)'.
    Error using mex
    directcountcond.c
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\xkeycheck.h(46): warning C4005: 'bool': macro redefinition
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\stdbool.h(15): note: see previous definition of 'bool'
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include\xkeycheck.h(48): fatal error C1189: #error: The C++ Standard Library forbids macroizing
    the keyword "bool". Enable warning C4005 to find the forbidden define.

    The Watch window is not very helpful in my case, because it works perfectly for variables with single number, when I would like to see variables containing vectors and matrices.

    Thank you for your help.
    Attached Files Attached Files

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured