c++,c,macros,preprocessor,openclRelated issues-Collection of common programming errors
Lightness Races in Orbit
c++ ubuntu
I got a fatal error that the file or directory <stdlib> is not found on ubuntu 11.xx when I typed #include <stdlib>.Is <stdlib> deprecated/removed, or is there something wrong with my GCC installation?
Joe
c++ visual-c++
I’ve been working on this for a while now and I can’t seem to figure it out. I cannot compile the code as it keeps throwing the below error. Basically what Im trying to do is create a vector which contains objects from both a base and derived class using pointers. Final Assignment.obj : error LNK2019: unresolved external symbol “public: __thiscall Product::Product(void)” (??0Product@@QAE@XZ) referenced in function “public: __thiscall SaleProduct::SaleProduct(char,class std::basic_string,class st
lim
c++ g++ compiler-errors
I’m getting this compilation error: fatal error: can’t create precompiled header f: Text file busy compilation terminated. This is a very mysterious one, since i get it only once in a while..Where do i go wrong?
user1920
c++
I have seen all the articles on web, but nothing seems to resolve my issue.Someone plz help me out on this.I am using debug mode, VS 2010, .net 4 Framework.In project properties, CLR is on in general CLR in on in C++->general All .cpp files are having use (/yu) in precompiled hearder settings stdafx.cpp has /yc (create) with clr on
Donbeo
eclipse c++ opencv
I am using ubuntu 13.10 and I am trying to install opencv on eclipse. I am following this tutorial LINKI do not know where is my library. This what I obtain when I try to find the files. donbeo@donbeo-HP-EliteBook-Folio-9470m:~$ pkg-config –libs opencv-lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres –
Ell
c++ ogre3d
After attempting to install Ogre3d from source for Linux, it all built properly but I realized that I had built static libraries. I re-built using CMake again, this time un-ticking the static option. When I create a new Ogre Project in code::blocks and try to compile, I get: __________________________________________________ ____ _________________________________________________________ | /usr/local/include/OGRE/OgreStaticPluginLoader.h | 28 | fatal error: OgreCgPlugin.h: No such file or directo
user1666541
c++ makefile file-not-found
What I’ve already done:I’ve looked through other StackOverflow threads with similar issues, but none of them seem to apply to my specific case. I’ve also double checked to makes sure that the correct files are in the correct locations (folders) and that everything is named properly as well.This is the error I’m receiving:[[email protected]]$ make g++ -Wall -O2 -ansi -pedantic -o dog.cpp g++: fatal error: no input files compilation terminated. make: *** [mscp.o] Error 4Here’s the makefile in
Arco y Flecha
c++ netbeans libssh
#include <iostream> #include <cstdlib> #include <windows.h> #include <libssh.h> #include <stdlib.h>using namespace std;/** */ int main(int argc, char** argv) I have that code, and when compiling the error fatal of no Libssh.h is appearing, but when i SHIFT+CLICK over the libssh.h include instruction i jump to the file that already exist and is installed.I have include it on Netabeans options for C++ compiling.Any ideas?Regards.
Piterwilson
android c++ eclipse ffmpeg jni
The tooltip is over the line #include <libavcodec/avcodec.h>I’m new to JNI development. After managing to compile FFMPEG i fail to be able to use it on a project.On the screenshot you can see that the folder with the libs and includes is referenced under includes (via Project/properties/C/C++ general/paths and symbols)To me it looks like it should find it but i get the error.What extra place do i have to specify this folder for the build to work?Edit : contents of Android.mkLOCAL_PATH := $
user2883880
c++ mysql compiler
I have the following code#include <my_global.h> #include <mysql.h>int main(int argc, char **argv) {printf(“MySQL client version: %s\n”, mysql_get_client_info());exit(0); }when i try to compile it usinggcc mysqldb.c -o mysql -I/usr/include/mysql -lmysqlclient i get an error saying fatal error mysql.h:No such file or directory. how can i successfully compile and run the code
Jorge Castro
c++ c
I read somewhere that I need to install ‘build essential packager’ & so I tried:sudo apt-get install build-essential Reading package lists… Done Building dependency tree Reading state information… Done build-essential is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.But the file still wont compile or run…gcc -Wall -W -Werror factorial.cpp -o factorial.gives me: gcc -Wall -W -Werror factorial.cpp -o factorial. factorial.cpp:3:22: fatal
user3050080
c
#include <stdio.h> #include <conio.h> #include <math.h> #include <stdlib.h>void rpt(in[30]) //Repeat Function{ char in[30]; int a, out = 0, b, c; printf( “Enter a sentence, please. \n”); gets(in); for(a = 0; in[a] != ‘\0’; a++) {out = out + 1;} for(c = 0; c < out; c++) { for(b = 0; b <out; b++) {printf(“%c”, in[b]); }getche (); return sonuc; } void avg(in[30]) //Average number of letters per word function{ char in[30]; int a; float avg, out = 0, b = 0; printf( “Ente
Smamatti
c linux linux-kernel directfb
I am trying to build Linux Fusion for DirectFB. I downloaded it from directfb.org .The steps are described in README. They are asking for modprobe fusion after make and make install.When i run this command i get the error:Module Fusion not found.What are possible issues and how can I resolve them?
Eliah Kagan
12.04 ubuntu-netbook compiling c++ c
I have some question about compiling .cpp inside a folder, it says first.cpp No such file or directorybut when I run it in home it compiles. Any settings I might have left out? Thanks.Here’s the Terminal output (view it bigger):law@ubuntu:~$ ls android-sdk Downloads Pictures test wallpapers android-sdks eclipse Public tomcat workspace Desktop examples.desktop sourcecodescpp Ubuntu One Documents Music Templates Videos
OrangeTux
c
I’m a beginner and I’m new to Ubuntu. I just installed it and want to run a C program. I have no idea what platform to use or where to write the code. I need to use pthread.h header file in the program. Can anyone help me?
Shog9
c linux winapi
I have an application in linux, which is compiled successfully. I want to run the same program in windows.But compilation produces the following errors related to header files.Cannot find sys/select.h Cannot find termios.hHow can I fix this?
bluefeet
c++ c berkeley-db
I wrote a program that uses the Berkeley DB in C/C++ like a mix. I have one class called bdb with this method.int open(char *db_name){flags = DB_CREATE;u_int32_t envCreateFlags = DB_CREATE |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_RECOVER |DB_THREAD;ret = db_env_create(&dbenv, 0);dbenv->err(dbenv,ret,”err db_env_create “); ret = dbenv->open(dbenv,”./”,envCreateFlags,0);dbenv->err(dbenv,ret,”err db_env_open “); ret = db_create(&dbp,dbenv, 0); dbp->err(
user 123456
c++ c visual-studio-2010 visual-studio visual-c++
just i wanted to make a program using viual stidio 2010 when i do build i have this excaption i just wrote empty main c++ program (no syntax errors)what i got is:1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup 1>c:\users\dell\documents\visual studio 2010\Projects\test\Debug\test.exe : fatal error LNK1120: 1 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========code is :#include <iostream> using namespace std;int main() {co
Nghia Vu
c++ c cygwin
I am attempting to compile C program on Window platform (currently, it’s running on AIX).Problem is: when I build this program, the compiler could not find procinfo.h file.I spent much time to search on the internet but still cannot solve this problem.fatal error: procinfo.h: No such file or directoryI am wonderful to receive your support. All helps will be appreciated. Thanks!
Jake Cooper
c eclipse
So, I had eclipse working, but I had to send my computer in for a replacement. Set up Eclipse with MinGW like I did before, and now it cannot resolve any of the header files.I’ve edited the environment variables and all that jazz, so I dunno what to do.EDIT: Also getting an unresolved inclusion error.
zed_0xff
assembly macros
.686 .MODEL flat, stdcall .STACK INCLUDE Irvine32.incReleaseArray MACRO ELem REPT ELem pop edi ENDM ENDMdet MACRO Dim Local Start ,skip , L1,L2,Els ,Elm ;recives array in stack ;recives,dh num elements,dl dimisien ;produce det in eaxmov edx ,Dim ;Elm = Dim*Dim shl edx,1 mov Elm ,edxpush ebp mov ebp,esp Start: cmp Dim,1 jne els mov eax,[ebp+4] ret 4 els: movzx ecx,Dim xor esi,esi xor eax,eaxL1: inc esi push ecx push esi push eax ; push array mov edi,dim mov ecx , Elm-dim L2: mov eax,dim div edi
EvilTeach
visual-c++ mfc macros compiler-errors vc6
I am facing a weird problem. I have got a file called in which I am using a macro called “WM_USER”, the macro is defined in another header file called . Now the problem is that when I am using the macro in the compiler doesn’t recognize it. Its not the case that I haven’t included , because earlier I wasn’t having any problems it came out of no where. Following is the error that is shown on the compiler:d:\project\project original\mirec2pc v1.0\gui\constants.h(26) : error C2065: ‘WM_USER’ : un
program-o-steve
java macros jni codeblocks
JNIEXPORT jint JNICALL JNI_Func(….) {…. }I get unsatisfied link error when i try to run the java program with macros (JNIEXPORT and JNICALL) in the native code. But when i remove the macros,i get no exception. Is it that the IDE Code::Blocks doesn’t support JNI macros ? If it supports what should i do to enable them ?Note : I don’t get a error or warning related to the macros defined . It just fails the run,as it gives me the unsatisfied link error.EDIT :Stacktrace :Exception in thread “main
Xeo
c++ c macros preprocessor tilde
Seen on this site, the code shows macro invocations using a tilde in parentheses:HAS_COMMA(_TRIGGER_PARENTHESIS_ __VA_ARGS__ (~)) // ^^^What does it mean / do? I suspect it to just be an empty argument, but I’m not sure. Is it maybe specific to C(99) like the __VA_ARGS__ is specific to C99 and existent in C++?
user1562021
c++ windows visual-c++ macros porting
I am new to C++ and facing one easy problem mention below. in visual C++ 2008, i am trying to #define something like #define fromThis* toThisPtr #define fromThis toThisObjI am porting some code that is written in linux and need to port in accordance to winapi. The error which i am getting something like this.error C2008: ‘*’ : unexpected in macro definitionwarning C4005: ‘fromThis’ : macro redefinitionsee previous definition of ‘fromThis’I need to redefine fromThis* and fromThis during prepr
erutan
excel vba excel-vba macros
I have an Excel sheet with values, and I want to automatically copy only the values that are highlighted (formatted with background color) to another sheet. I don’t mind using a macro, or if possible a function in the second sheet cells.I’ve tried to put a few suggestions together and created a function to return the cell color and this following macro to filter by the color value:Sub Sample()Dim ws As WorksheetDim strSearch As StringDim lRow As LongSet ws = Sheets(“Sheet1”)With wslRow = .Range(
molnardenes
excel vba macros duplicate-removal
Is it possible to use a function in Excel 2003 to delete an entire row if it’s the same as the previous one? For example:apple apple plum vinegar apple banana banana banana appleI want to delete #2, 7# and #8, but I don’t want #5 and #9 to be deleted. I want to delete a duplicated entry ONLY IF it’s the next one. I hope I managed to keep it clear to you. If there isn’t a function, how can I do that in VBA? Thanks in advance!
pssp
c macros concatenation
Consider the following code:1. #define SUFFIX 5-5 2. #define XFUNC_0( x ) (100 * x) 3. #define XFUNC_1( x ) (101 * x) 4. #define XFUNC_2( x ) (102 * x) 5. #define CATX( x, y ) x##y 6. #define CAT( x, y ) CATX( x, y ) 7. #define XFUNC CAT( XFUNC_, SUFFIX ) 8. #if XFUNC(2) == 200 …… etc N. #endifThis code does not seem very useful, this is because it is just a part of my real code, simplified. The question is: – how can I convince the preprocessor to perform first 5-5 (just a
Flexo
c macros define
I was wondering if there was a way in C language to define #define like this:#define something #define something a 42 something b 42
murftown
vim macros special-characters vimscript macvim
I have been playing around with vim macros lately (in MacVim at the moment), and sometimes I like to explicitly assign a macro into a register using e.g. :let @a='(macro keystrokes)’. This is generally working fine, but I found a weird behavior in which anytime I assign a string value that ends in Carriage Return / ^M, vim automatically adds a Linefeed / ^J to the end before putting it in the register, which affects the execution of the macro!Example: Let’s say I record a simple macro that get
LondonGrammar
c++ preprocessor
I have am getting fatal error C1017: invalid integer constant expression with the following piece of code:#if V1>0 //do stuff #endifV1 is defined as follows at the top of the .cpp file:#define V3 UINT32 #define V4 sizeof(V3) #define V1 (V2 % V4)V2 is defined as follows:const int V2 = 256;Can anybody see where I am going wrong?Thanks in advance!
paxdiablo
c gcc batch-file cygwin preprocessor
I’m using a proprietary development environment that compiles code written in C, as well as the IEC 61131 languages. For the C compilation, it uses GCC 4.1.2 with these build options: -fPIC -O0 -g -nostartfiles -Wall -trigraphs -fno-asm The compilation is done by a program running on windows utilizing Cygwin.My issue is, IEC language preprocessor is not that useful (doesn’t support #define at all) and I want to use macros! I don’t see why the GCC preprocessor would really care what language it i
Constantine Samoilenko
linux preprocessor
I’ve been assigned to cross compile samba 4.0.5 from i686 to MIPS in order to port it on board later. I’m compiling in ubuntu 13.04 .The error I get is:lib/sysquotas_4A.c: In function ‘sys_get_vfs_quota’: lib/sysquotas_4A.c:107:10: error: ‘struct dqblk’ has no member named ‘dqb_curblocks’ lib/sysquotas_4A.c:124:10: error: ‘struct dqblk’ has no member named ‘dqb_curblocks’ lib/sysquotas_4A.c:170:29: error: ‘struct dqblk’ has no member named ‘dqb_curblocks’ The following command failed: cc -fno-bu
Xeo
c++ c macros preprocessor tilde
Seen on this site, the code shows macro invocations using a tilde in parentheses:HAS_COMMA(_TRIGGER_PARENTHESIS_ __VA_ARGS__ (~)) // ^^^What does it mean / do? I suspect it to just be an empty argument, but I’m not sure. Is it maybe specific to C(99) like the __VA_ARGS__ is specific to C99 and existent in C++?
goldfrapp04
c++ qt build preprocessor define
Just a Qt Gui Application with QDialog as the Base Class, the simplest type you can expect. I’ve programmed on Qt for several times but this is the first time I meet this problem… I’ve added minimal code to the program, and here’s the code in dialog.h (which is mostly automatically generated)#ifndef DIALOG_H #define DIALOG_H#include <QDialog> #include <QPixmap> #include “bmp.h”namespace Ui {class Dialog; }class Dialog : public QDialog {Q_OBJECTpublic:explicit Dialog(QWidget *parent
Saad Imran.
c++ pointers preprocessor class-design
I’m trying to write 2 classes with members that reference each other. I’m not sure if I’m doing something wrong or it’s just not possible. Can anyone help me out here…Source.cpp#include “Headers.h” using namespace std;void main() {Network* network = new Network();system(“pause”);return; }Headers.h#ifndef Headers_h #define Headers_h#include <iostream> #include <vector> #include “Network.h” #include “Router.h”#endifNetwork.h#include “Headers.h”class Network { protected:vector<Rout
Jason R. Mick
c++ preprocessor string-literals
Given an compile-time constant integer (an object, not a macro), can I combine it with a string literal at compile time, possibly with the preprocessor?For example, I can concatenate string literals just by placing them adjacent to each other:bool do_stuff(std::string s); //… do_stuff(“This error code is ridiculously long so I am going to split it onto “”two lines!”);Great! But what if I add integer constants in the mix:const unsigned int BAD_EOF = 1; const unsigned int BAD_FORMAT = 2; const
Joe
c++ c preprocessor
I would like to know what the cons are of using the preprocessor in such a way:#define SOME_FUNCTION someFunction(someArgument)Basically I feel like this is wrong (or certainly not a best practice) – but I’m not sure why… my preprocessor skills are rusty at best.thanks, A
casperOne
matlab design cuda preprocessor
I’m coding CUDA in Matlab mex-Files. When you look at CUDA examples on the internet or even manuals from nvidia, you often see the use of preprocessing variables to specify the problem size, e.g. the vector length for a vector addition or something like this. I coded my program also like this: Preprocessing Variables for specifying the problem size. And I have to admit it: I like it since you can access those everywhere in your code, e.g. as limits in a loop or something like this, without havin
bhups
c programming-languages preprocessor
I wonder why other languages do not support this feature. What I can understand that C / C++ code is platform dependent so to make it work (compile and execute) across various platform, is achieved by using preprocessor directives. And there are many other uses of this apart from this. Like you can put all your debug printf’s inside #if DEBUG … #endif. So while making the release build these lines of code do not get compiled in the binary. But in other languages, achieving this thing (later pa
hbdgaf
ati gpu opencl
I want to use my GPU with Pyrit. I use Ubuntu 11.10, ATI Radeon HD 68xx and i7 2600K.Step done:Install latest ATI driver from manufacturer website Install AMD APP SDK When I run benchmark I get:~$ pyrit benchmark Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com This code is distributed under the GNU General Public License v3+Running benchmark (5037.4 PMKs/s)… – Computed 5037.45 PMKs/s total. #1: ‘CPU-Core (SSE2)’: 667.8 PMKs/s (RTT 3.2) #2: ‘CPU-Core (SSE2)’: 661.6 PMKs/s (RTT
vandale
java opencl lwjgl
When using opencl via LWJGL, I am getting the following error message:# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000002201971, pid=8476, tid=8920 # # JRE version: 7.0_03-b05 # Java VM: Java HotSpot(TM) 64-Bit Server VM (22.1-b02 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [OpenCL.dll+0x1971] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Win
14 revs, 2 users 95%huseyin tugrul buyukisik
java opencl jocl
Edit: Problem solved! rzymek’s answer was helpful.Question: For JOCL, how can I exclude some cores of CPU from the opencl calculations with device fission?(Java port of cl_device_partition_property seems to be corrupt for 0.1.9 version)Edit: I found this:clCreateSubDevices(devices[0][1],core , 1, cpuCores, coreIDs);but java/jocl doesnt accept this:cl_device_partition_property core=CL.CL_DEVICE_PARTITION_BY_COUNTS;error is:Type mismatch: cannot convert from int to cl_device_partition_propertyJust
Rohit Sarewar
hadoop mapreduce opencl gpu jocl
I am using CDH4 and I am trying to access GPU from cleanup() method of mapper class using JOCL. (Note: My normal code(without map reduce) works fine on GPU).When I execute my map-reduce code, It throws an error (specified below).attempt_201309171647_0021_m_000000_1: No protocol specified attempt_201309171647_0021_m_000000_1: No protocol specified 13/09/20 18:03:01 INFO mapred.JobClient: Task Id : attempt_201309171647_0021_m_000000_2, Status : FAILED org.jocl.CLException: CL_DEVICE_NOT_FOUNDat or
Ryan Naddy
java image-processing opencl image-manipulation jocl
I have this simple block of OpenCL code, and I am getting unexpected results. The parameters image is an array of floats and value is a number from -255 to +255. Using java I use a JSlider to change the value. The default value is 0 and the problem is when I move the slider more than 0 the image is black, if I move it less than 0 the image is white, which shouldn’t happen. This should be checking each pixel individually and adjusting that pixel. It doesn’t seem to be for some reason.This block o
ssarangi
opencl
I am continuously getting an Access Violation Error with a all my kernels which I am trying to build. Other kernels which I take from books seem to work fine. https://github.com/ssarangi/VideoCL – This is where the code is. Something seems to be missing in this. Could someone help me with this. Thanks so much.[James] – Thanks for the suggestion and you are right. I am doing it on Win 7 with a AMD Redwood card. I have the Catalyst 11.7 drivers with AMD APP SDK 2.5. I am posting the code below.#in
Bart
ide opencl
I’ve got some experience with OpenGL and it’s programmable pipeline. I’d like to give OpenCL a try, though.Could somebody propose a nice integrated kit for working with OpenCL?I know only of QuartzComposer which looks nice, but it’s mac-only. Anyone knows if it supports hand-editing of OpenCL kernels or is it all only through the GUI?Any other Linux / Windows alternative?
Timothy Baldridge
opencl
Is there a way to use C style function pointers in OpenCL?In other words, I’d like to fill out a OpenCL struct with several values, as well as pointers to a OpenCL function. I’m not talking about going from a CPU function to a GPU function, I’m talking about going from a GPU function to a GPU function. Is this possible?— EDIT —If not, it there a way around this? In CUDA we have object inheritance, and in 4.0 we even have virtual functions. About the only way I can find to implement a runtime
user1111929
opencl
Given a float[n] inputdata to pass to the OpenCL kernel, could anyone enlighten me on the difference between the following three ways to pass this to the kernel:A)cl_mem input = clCreateBuffer(context, CL_MEM_USE_HOST_PTR Sizeof.cl_float * n,inputdata, NULL); clSetKernelArg(kernel, i, Sizeof.cl_mem, Pointer.to(input));B)clSetKernelArg(kernel, i, Sizeof.cl_float * n, Pointer.to(inputdata));C)cl_mem input = clCreateBuffer(context, CL_MEM_options_here, Sizeof.cl_float * n,NULL, NULL); clEnqueueWrit
user1286187
driver opencl
I have implemented a project on my computer using AMD SDK v2.5 and ATI Catalyst drivers, as I have an ATI HD5570 graphics card. I would like my executable to run on a different platform. I would like to be able to check whether an available OpenCL platform can be found on the configuration my executable is run. And of course the configuration can have Nvidia graphics card.I have searched over internet but I couldn’t find a final answer to my question. I am totally lost through my seach. Is there
Web site is in building