header-files

Disabling vim's location list on missing C header file

邮差的信 提交于 2019-12-24 20:28:16
问题 Vim is pretty smart when it comes to C, so if one inserts a bogus header file such as #include <stdioo.h> , it complains by bringing up a location list with the following error: foo.c:1|20| fatal error: stdioo.h: No such file or directory || compilation terminated. Which is great, but for whatever reason, I get the same error when including the <mpi.h> header file. I know this is a vim problem b/c I can compile and execute the program with mpicc and mpiexec , respectively. Besides it being

Use variable across multiple Cpp files

﹥>﹥吖頭↗ 提交于 2019-12-24 18:12:58
问题 Have searched enough answers but none of the solutions work for me. scenario : I am trying to include a .h file that has some functions declared (not defined) and some variables declared. If I include this header file in the source files (2 to be precise) that actually use the functions and variables, then the last one that compiles has a linker error that states undefined reference to `abc::myfun(char const*, char const*, char*)' All the functions and variables in the header files have been

How To Compile C++ Code that has a 'wlanapi.h' and 'windows.h' dependency

馋奶兔 提交于 2019-12-24 14:06:55
问题 I am modifying an open source code that scans for Wireless signals in the vicinity. The program code goes like this: #pragma comment(lib, "wlanapi.lib") #include <stdio.h> #include <windows.h> #include <wlanapi.h> VOID WlanNotification(WLAN_NOTIFICATION_DATA *wlanNotifData,VOID *p) { if(wlanNotifData->NotificationCode == wlan_notification_acm_scan_complete) { bWait = false; } else if(wlanNotifData->NotificationCode == wlan_notification_acm_scan_fail) { printf("Scanning failed with error: %x\n

C++ array in header file

风格不统一 提交于 2019-12-24 12:51:30
问题 I am doing a training exercise and am having trouble getting started on it. I have to write a program for an array data structure. There is a test harness provided and I need to implement the code for the data structure. I am not sure how to define an array in a header file bellow is the test harness main.cpp which i can not edit #include <fstream> #include <iostream> using namespace std; // ***************************** // you need to create this class // *****************************

Clang++ fails to locate any stdlib headers

只愿长相守 提交于 2019-12-24 12:39:29
问题 From a mac os x system I am trying to cross compile a simple C++11 program but clang++ fails to find even simple headers: test.cc #include <string> int main(int argc, char *argv[]) { return 0; } And here is the error $ clang++ --std=c++11 --stdlib=libc++ test.cc -target i386-win32 -o test clang: warning: argument unused during compilation: '--stdlib=libc++' test.cc:1:10: fatal error: 'string' file not found #include <string> ^ 1 error generated. It compiles just fine without the -target

Are the Swift language headers available online?

微笑、不失礼 提交于 2019-12-24 12:34:41
问题 Are the Swift headers available anywhere? I'd like to dig a bit deeper into some of the classes, but I don't have my Mac with me at the moment. Is there another option to view the Swift language source files? 回答1: At the moment, in the Xcode6 beta, the swift "header files" aren't really header files. (i.e. they don't exist on disk in plain text format.) They appear to be getting generated on the fly by Xcode from the *.swiftmodule and *.swiftdoc files in the Xcode bundle. Similarly, the swift

Multiple of same error while compiling "error: expected ')' before '*' token

点点圈 提交于 2019-12-24 04:19:17
问题 I am trying to program in C. When I compile with the following arguments.... gcc -D_BSD_SOURCE -Wall -ansi -pedantic -g tokenizer.c FileOccur.c WordList.c wordstat.c indexer.c -o indexer I get this from terminal as a response: In file included from ../Headers/WordList.h:11, from FileOccur.c:12: ../Headers/FileOccur.h:18: error: expected ‘)’ before ‘*’ token ../Headers/FileOccur.h:20: error: expected ‘)’ before ‘*’ token In file included from ../Headers/WordList.h:11, from WordList.c:11: ..

Gcc fails to recognize `-I../path`

丶灬走出姿态 提交于 2019-12-24 02:52:33
问题 I have a problem with linking and gcc, probably resulting from a stupid mistake on my side. Drawing from this post Header files linked to from header file not found, I tried the -I option to inlcude header files, but gcc just does not seem to recognize the parameter. ~/Documents/projects/opencl/NVIDIA_GPU_Computing_SDK/src_l$ gcc opencl_hello_world.c –I../OpenCL/common/inc/CL/ –L/usr/local/cuda/lib –lOpenCL gcc: –I../OpenCL/common/inc/CL/: No such file or directory gcc: –L/usr/local/cuda/lib:

How to stop propagating declarations through hierarchical includes?

可紊 提交于 2019-12-24 02:43:12
问题 Whenever I make a .h header file, a question comes to my mind: "How to stop propagating declarations through hierarchical includes?" Assume there are these below files: foo.h #ifndef FOO_H #define FOO_H typedef int foo_t; inline int foo() { return 1; } class foo_c {}; #endif /* FOO_H */ bar.h #ifndef BAR_H #define BAR_H #include "Foo.h" typedef foo_t bar_t; inline int bar() { return foo(); } class bar_c : public foo_c {}; #endif /* BAR_H */ zoo.h #ifndef ZOO_H #define ZOO_H #include "Bar.h"

Can global auto variables be declared in h files? [duplicate]

会有一股神秘感。 提交于 2019-12-24 02:14:21
问题 This question already has an answer here : extern auto variable has no initializer (1 answer) Closed 4 months ago . Somewhat similar to this post, but still different: can I define a global auto variable in some header file? I tried using the following files, but couldn't make them compile. $ cat main.cpp auto a = 5; #include "defs.h" int main(int argc, char **argv){ return a; } $ cat defs.h #ifndef __DEFS_H__ #define __DEFS_H__ extern auto a; #endif And after standard compilation ( g++ main