header-files

VSCode and MPI in WSL

心不动则不痛 提交于 2019-12-13 06:20:38
问题 I use MPI in a C program in Visual Studio Code on Windows. I compile and run it in WSL just fine, but VSCode warns me that it can't find mpi.h : I have installed libopenmpi-dev in WSL and added the header directories to VSCode's settings ( .vscode/c_cpp_properties.json ): { "configurations": [ { "name": "WSL", "includePath": [ "${workspaceFolder}/**", "/usr/lib/gcc/x86_64-linux-gnu/7/include", "/usr/local/include", "/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed", "/usr/include/x86_64-linux

Source file cannot find the header files

帅比萌擦擦* 提交于 2019-12-13 02:54:29
问题 I have looked at these links : This one and This and a couple of other similar ones. None of the answers given here are working methods are working. I have a two source files a1.c , a2.c and two header files a1.h and a2.h . I want to include the header files in both these files (and a2.c in a1.c as there is a function I need to use from a2.c) I have included #include "a1.h" #include "a2.h" in the source files of a1.c I'm using GCC on Ubuntu. and using the command gcc a1.h -o a1.out -lm and

Static libraries and headers in another directories with GCC

放肆的年华 提交于 2019-12-13 01:24:12
问题 I was looking here how to do static libraries using GCC, and the explanation is pretty clear (despise the fact I had to rewrite the factorial function): I have a function (fact.c), the header of the function (fact.h), and the main function (main.c), all of them in my home directory. fact.h int fact (int); fact.c int fact (int f) { if ( f == 0 ) return 1; else return (f * fact ( f - 1 )); } main.c #include <stdio.h> #include "fact.h" int main(int argc, char *argv[]) { printf("%d\n", fact(3));

How is a header file being compiled into the executable file?

℡╲_俬逩灬. 提交于 2019-12-12 15:42:14
问题 When you include a header file (.h, .hpp, .hh, .hxx extensions) from the C Standard Library or the C++ STL (or even include a Microsoft's big one like windows.h ), and use only a certain limited number of functions from it, does the whole file become binary and be copied to the executable file, or just the specific, relevant functions that are being used become binary? If the whole file is being copied (and that's what I think actually happens, since windows.h has macro-defines to reduce

What could be the purpose of a header file with raw data?

ε祈祈猫儿з 提交于 2019-12-12 15:14:56
问题 Decided to check out some code other than my own, Quake I was the choice. The first file I click on is filled with nothing but raw data and the only comments are the GPL. I am guessing it is an array containing normal vectors? Regardless of what its purpose was, what confuses me is what it is doing in a header file anorms.h. I am wondering what could be the purpose of doing this? The other source, actual code, feels fairly complicated to me. As a novice programmer I probably just need to

Syntax error while converting IDL to C header

别等时光非礼了梦想. 提交于 2019-12-12 11:46:02
问题 I am trying to get C header files for COM interfaces using OLE/COM object viewer. I have tries to save type library as header file in object viewer, however, after a cmd window flashes, nothing happens. I have tried to save it as IDL file and convert to header file myself using this command; midl /out C:\temp /header EXCEL.h EXCEL.IDL However, I am getting this error: Microsoft (R) 32b/64b MIDL Compiler Version 7.00.0555 Copyright (c) Microsoft Corporation. All rights reserved. 64 bit

- Default value of variables at the time of declaration -

强颜欢笑 提交于 2019-12-12 09:47:01
问题 I was wondering what were the default values of variables before I initialized them... For example, if I do : //myClass.h BOOL myBOOL; // default value ? NSArray *myArray; // default value ? NSUInteger myInteger; // default value ? Some more examples here : //myClass.m // myArray is not initialized, only declared in .h file if ([myArray count] == 0) { // TRUE or FALSE ? // do whatever } More generally, what is returned when I do : [myObjectOnlyDeclaredAndNotInitialized myCustomFunction];

What difference does it make when I include <limits> or <limits.h> in my c++ code

时间秒杀一切 提交于 2019-12-12 09:29:41
问题 Can somebody please explain this? #include <iostream> #include <limits.h> or #include <iostream> #include <limits> 回答1: <limits> is a C++ Standard Library header providing similar insights to the C header <limits.h> (which is also available in C++ as <climits>), but it is written in a way that's more useful and safe in C++ programs: say you have a template <typename Numeric> ... , and the code inside wants to know the minimum and maximum value of the Numeric type parameter that the user

Do template specialisations belong into the header or source file?

谁说胖子不能爱 提交于 2019-12-12 09:29:28
问题 During compilation I get a "multiple definition" error, which refers to a template specialisation in a header file. Do I need to put the specialisations into the source file? 回答1: If it is functions you have specialized, you can either put them in the .cpp file, or make them inline in the header. Like James points out, if you don't make the functions inline, you still have to declare the specializations in the header. Otherwise the compiler doesn't know it has to look for them elsewhere. You

Where can I find source of string.cpp

我与影子孤独终老i 提交于 2019-12-12 08:59:59
问题 I want to access source file of string.h . I mean the file which have definitions of all functions available in string.h . For example strcpy() is a function in string.h ; where can I get its definition, as string.h only gives prototypes of functions? 回答1: You didn't specify a developer tool - this answer is for Visual Studio 2008 on Windows. CRT sources can be found under: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\crt\src\ if it's installed at the default location. For other