Search Results

Search found 1644 results on 66 pages for 'cpp fanatic'.

Page 24/66 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Boost python module building

    - by Ockonal
    Hello, I'm using boost.python and I need in building some module for it. I have an some_module.cpp file in project. How can I build it correctly to the shared library for using it with python in future? When I learned it, I had only 1 file and I built it with command: gcc -shared -Wl,-soname,hello.so -o hello.so test.cpp -I /usr/include/python2.6/ -lboost_python And I don't know how to configure it in whole project. I'm using Eclipse and Code::Blocks IDEs.

    Read the article

  • How do I copy object in Qt?

    - by Martin
    I'm using Qt and have some real basic problems. I have created my own widget MyTest that have a variable obj. I need to set this variable obj from an object outside of the widget so that the variable is copied not just a pointer to another object. I get an error message and can't figure out how to do this basic stuff. This is the code I'm using: MyTest.h: class MyTest : public QWidget { Q_OBJECT public: void setObj(QObject &inobj); QObject obj; .... } MyTest.cpp: void MyTest::setObj(QObject &inobj) { obj = inobj; //HERE I get the error message: "illegal access from 'QObject' to protected/private member 'QObject::operator=(const QObject &)'" } main.cpp: int main(int argc, char *argv[]) { QApplication a(argc, argv); QObject *ob = new QObject(); MyTest w; w.setObj(*ob); } Thanks for your help!

    Read the article

  • error C2065: 'CComQIPtr' : undeclared identifier

    - by Ken Smith
    I'm still feeling my way around C++, and am a complete ATL newbie, so I apologize if this is a basic question. I'm starting with an existing VC++ executable project that has functionality I'd like to expose as an ActiveX object (while sharing as much of the source as possible between the two projects). I've approached this by adding an ATL project to the solution in question, and in that project have referenced all the .h and .cpp files from the executable project, added all the appropriate references, and defined all the preprocessor macros. So far so good. But I'm getting a compiler error in one file (HideDesktop.cpp). The relevant parts look like this: #include "stdafx.h" #define WIN32_LEAN_AND_MEAN #include <Windows.h> #include <WinInet.h> // Shell object uses INTERNET_MAX_URL_LENGTH (go figure) #if _MSC_VER < 1400 #define _WIN32_IE 0x0400 #endif #include <atlbase.h> // ATL smart pointers #include <shlguid.h> // shell GUIDs #include <shlobj.h> // IActiveDesktop #include "stdhdrs.h" struct __declspec(uuid("F490EB00-1240-11D1-9888-006097DEACF9")) IActiveDesktop; #define PACKVERSION(major,minor) MAKELONG(minor,major) static HRESULT EnableActiveDesktop(bool enable) { CoInitialize(NULL); HRESULT hr; CComQIPtr<IActiveDesktop, &IID_IActiveDesktop> pIActiveDesktop; // <- Problematic line (throws errors 2065 and 2275) hr = pIActiveDesktop.CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER); if (!SUCCEEDED(hr)) { return hr; } COMPONENTSOPT opt; opt.dwSize = sizeof(opt); opt.fActiveDesktop = opt.fEnableComponents = enable; hr = pIActiveDesktop->SetDesktopItemOptions(&opt, 0); if (!SUCCEEDED(hr)) { CoUninitialize(); // pIActiveDesktop->Release(); return hr; } hr = pIActiveDesktop->ApplyChanges(AD_APPLY_REFRESH); CoUninitialize(); // pIActiveDesktop->Release(); return hr; } This code is throwing the following compiler errors: error C2065: 'CComQIPtr' : undeclared identifier error C2275: 'IActiveDesktop' : illegal use of this type as an expression error C2065: 'pIActiveDesktop' : undeclared identifier The two weird bits: (1) CComQIPtr is defined in atlcomcli.h, which is included in atlbase.h, which is included in HideDesktop.cpp; and (2) this file is only throwing these errors when it's referenced in my new ATL/AX project: it's not throwing them in the original executable project, even though they have basically the same preprocessor definitions. (The ATL AX project, naturally enough, defines _ATL_DLL, but I can't see where that would make a difference.) My current workaround is to use a normal "dumb" pointer, like so: IActiveDesktop *pIActiveDesktop; HRESULT hr = ::CoCreateInstance(CLSID_ActiveDesktop, NULL, // no outer unknown CLSCTX_INPROC_SERVER, IID_IActiveDesktop, (void**)&pIActiveDesktop); And that works, provided I remember to release it. But I'd rather be using the ATL smart stuff. Any thoughts?

    Read the article

  • Can I get build warnings from a custom build step in Qt Creator?

    - by Derick
    I have the following script that I run as a custom build step in Qt Creator: git ls-files . | egrep "\.cpp$|\.h$" | xargs vera++ Which then gives output: foo/bar.cpp:1: no copyright notice found Another script I also use is: cppcheck . --template gcc -q --enable=style,unusedFunctions With the output: apple.h:8: style: The class 'MyPie' has no constructor. Member variables not initialized. I would love to double-click on the error and go to the source in the Compile Output window. It seems that only gcc errors are detected and these custom ones are ignored even though they have the same format.

    Read the article

  • error C2065: undeclared identifier

    - by karikari
    Currently, I have this function inside my other cpp file: UINT32 functionHtml(const wchar_t *url) { WinHttpClient client(url); client.SendHttpRequest(); wstring httpResponseHeader = client.GetHttpResponseHeader(); wstring httpResponse = client.GetHttpResponse(); writeToLog(httpResponse.c_str()); return 0; } I have another cpp file, and I would like to execute the stuff inside the above file. Here is the code for the other file: HRESULT CButtonDemoBHO::onDocumentComplete(IDispatch *pDisp, VARIANT *vUrl){ ATLTRACE("CButtonDemoBHO::onDocumentComplete %S\n", vUrl->bstrVal); // <---- i would like to call funtionHTML here or .. if (isMainFrame(pDisp)){ m_normalPageLoad=false; // <---- here.. MessageBox(m_hWnd, L"Main Document has completed loading", L"Document Complete", MB_OK); return S_OK; } return S_OK; } I got the error C2065: 'url' : undeclared identifier. Need help.

    Read the article

  • Singleton code linker errors in vc 9.0. Runs fine in linux compiled with gcc

    - by user306560
    I have a simple logger that is implemented as a singleton. It works like i want when I compile and run it with g++ in linux but when I compile in Visual Studio 9.0 with vc++ I get the following errors. Is there a way to fix this? I don't mind changing the logger class around, but I would like to avoid changing how it is called. 1>Linking... 1>loggerTest.obj : error LNK2005: "public: static class Logger * __cdecl Logger::getInstance(void)" (?getInstance@Logger@@SAPAV1@XZ) already defined in Logger.obj 1>loggerTest.obj : error LNK2005: "public: void __thiscall Logger::log(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?log@Logger@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) already defined in Logger.obj 1>loggerTest.obj : error LNK2005: "public: void __thiscall Logger::closeLog(void)" (?closeLog@Logger@@QAEXXZ) already defined in Logger.obj 1>loggerTest.obj : error LNK2005: "private: static class Logger * Logger::_instance" (?_instance@Logger@@0PAV1@A) already defined in Logger.obj 1>Logger.obj : error LNK2001: unresolved external symbol "private: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > Logger::_path" (?_path@Logger@@0V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@A) 1>loggerTest.obj : error LNK2001: unresolved external symbol "private: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > Logger::_path" (?_path@Logger@@0V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@A) 1>Logger.obj : error LNK2001: unresolved external symbol "private: static class boost::mutex Logger::_mutex" (?_mutex@Logger@@0Vmutex@boost@@A) 1>loggerTest.obj : error LNK2001: unresolved external symbol "private: static class boost::mutex Logger::_mutex" (?_mutex@Logger@@0Vmutex@boost@@A) 1>Logger.obj : error LNK2001: unresolved external symbol "private: static class std::basic_ofstream<char,struct std::char_traits<char> > Logger::_log" (?_log@Logger@@0V?$basic_ofstream@DU?$char_traits@D@std@@@std@@A) 1>loggerTest.obj : error LNK2001: unresolved external symbol "private: static class std::basic_ofstream<char,struct std::char_traits<char> > Logger::_log" (?_log@Logger@@0V?$basic_ofstream@DU?$char_traits@D@std@@@std@@A) The code, three files Logger.h Logger.cpp test.cpp #ifndef __LOGGER_CPP__ #define __LOGGER_CPP__ #include "Logger.h" Logger* Logger::_instance = 0; //string Logger::_path = "log"; //ofstream Logger::_log; //boost::mutex Logger::_mutex; Logger* Logger::getInstance(){ { boost::mutex::scoped_lock lock(_mutex); if(_instance == 0) { _instance = new Logger; _path = "log"; } } //mutex return _instance; } void Logger::log(const std::string& msg){ { boost::mutex::scoped_lock lock(_mutex); if(!_log.is_open()){ _log.open(_path.c_str()); } if(_log.is_open()){ _log << msg.c_str() << std::endl; } } } void Logger::closeLog(){ Logger::_log.close(); } #endif ` ... #ifndef __LOGGER_H__ #define __LOGGER_H__ #include <iostream> #include <string> #include <fstream> #include <boost/thread/mutex.hpp> #include <boost/thread.hpp> using namespace std; class Logger { public: static Logger* getInstance(); void log(const std::string& msg); void closeLog(); protected: Logger(){} private: static Logger* _instance; static string _path; static bool _logOpen; static ofstream _log; static boost::mutex _mutex; //check mutable }; #endif test.cpp ` #include <iostream> #include "Logger.cpp" using namespace std; int main(int argc, char *argv[]) { Logger* log = Logger::getInstance(); log->log("hello world\n"); return 0; }

    Read the article

  • multiple definition of inline function

    - by K71993
    Hi, I have gone through some posts related to this topic but was not able to sort out my doubt completly. This might be a very navie question. Code Description I have a header file "inline.h" and two translation unit "main.cpp" and "tran.cpp". Details of code are as below inline.h file details #ifndef __HEADER__ #include <stdio.h> extern inline int func1(void) { return 5; } static inline int func2(void) { return 6; } inline int func3(void) { return 7; } #endif main.c file details are below #define <stdio.h> #include <inline.h> int main(int argc, char *argv[]) { printf("%d\n",func1()); printf("%d\n",func2()); printf("%d\n",func3()); return 0; } tran.cpp file details (Not that the functions are not inline here) #include <stdio.h> int func1(void) { return 500; } int func2(void) { return 600; } int func3(void) { return 700; } Question The above code does not compile in gcc compiler whereas compiles in g++ (Assuming you make changes related to gcc in code like changing the code to .c not using any C++ header files... etc). The error displayed is "duplicate definition of inline function - func3". Can you clarify why this difference is present across compile? When you run the program (g++ compiled) by creating two seperate compilation unit (main.o and tran.o and create an executable a.out), the output obtained is 500 6 700 Why does the compiler pick up the definition of the function which is not inline. Actually since #include is used to "add" the inline definiton I had expected 5,6,7 as the output. My understanding was during compilation since the inline definition is found, the function call would be "replaced" by inline function definition. Can you please tell me in detailed steps the process of compilation and linking which would lead us to 500,6,700 output. I can only understand the output 6. Thanks in advance for valuable input.

    Read the article

  • cc1plus: error: include: Value too large for defined data type when compiling with g++

    - by Android
    I am making a project that should compile on Windows and Linux. I have made the project in Visual Studio and then made a makefile for linux. I created all the files in Windows with VS. It compiles and runs perfectly in VS but when I run the makefile and it runs g++ I get $ g++ -c -I include -o obj/Linux_x86/Server.obj src/Server.cpp cc1plus: error: include: Value too large for defined data type cc1plus: error: src/Server.cpp: Value too large for defined data type The code is nothing more than a Hello World atm. I just wanted to make sure that everything was working before I started development. I have tried searching but to no avail. Any help would be appreciated.

    Read the article

  • Resize an array of images with OpenCV

    - by amr
    I'm passing an array of images (IplImage**) to an object in C++ using OpenCV. I'm then trying to iterate over that array and resize them all to a fixed size (150x150) I'm doing it this way: for(int i = 0; i< this->numTrainingFaces; i++) { IplImage* frame_copy = cvCreateImage( cvSize(150,150), this->faceImageArray[0]->depth, this->faceImageArray[0]->nChannels ); cout << "Created image" << endl; cvResize(this->faceImageArray[i], frame_copy); cout << "Resized image" << endl; IplImage* grey_image = cvCreateImage( cvSize( frame_copy->width, frame_copy->height ), IPL_DEPTH_8U, 1 ); cout << "Created grey image" << endl; cvCvtColor( frame_copy, grey_image, CV_RGB2GRAY ); cout << "Converted image" << endl; this->faceImageArray[i] = grey_image; cvReleaseImage(&frame_copy); cvReleaseImage(&grey_image); } But I'm getting this output, and I'm not sure why: Created image Resized image Created grey image Converted image Created image OpenCV Error: Assertion failed (src.type() == dst.type()) in cvResize, file /build/buildd/opencv-2.1.0/src/cv/cvimgwarp.cpp, line 3102 terminate called after throwing an instance of 'cv::Exception' what(): /build/buildd/opencv-2.1.0/src/cv/cvimgwarp.cpp:3102: error: (-215) src.type() == dst.type() in function cvResize Aborted I'm basically just trying to replace the image in the array with the resized one in as few steps as possible. Edit: Revised my code as follows: for(int i = 0; i< this->numTrainingFaces; i++) { IplImage* frame_copy = cvCreateImage( cvSize(150,150), this->faceImageArray[i]->depth, this->faceImageArray[i]->nChannels ); cvResize(this->faceImageArray[i], frame_copy); IplImage* grey_image = cvCreateImage( cvSize( frame_copy->width, frame_copy->height ), IPL_DEPTH_8U, 1 ); cvCvtColor( frame_copy, grey_image, CV_RGB2GRAY ); faceImageArray[i] = cvCreateImage( cvSize(grey_image->width, grey_image->height), grey_image->depth, grey_image->nChannels); cvCopy(grey_image,faceImageArray[i]); cvReleaseImage(&frame_copy); cvReleaseImage(&grey_image); } Then later on I'm performing some PCA, and get this output: OpenCV Error: Null pointer (Null pointer to the written object) in cvWrite, file /build/buildd/opencv-2.1.0/src/cxcore/cxpersistence.cpp, line 4740 But I don't think my code has got to the point where I'm explicitly calling cvWrite, so it must be part of the library. I can give a full implementation if necessary - is there anything in my code that's going to create a null pointer?

    Read the article

  • How can we avoid packet missing in UDP Flex?

    - by Naveen kumar
    Hi all, I'm trying to send large files using UDP Adobe air to CPP. While transferring large files some packets are missing. How can I retrieve the missing packets data? I'm first of all connecting client(air) with server(cpp) using tcp. After connection establishment I'm starting file transfer. I am planning to get the file missing data using tcp and then resending the missing packets using tcp. Can anybody tell me how can i come to know which packets are missing while transferring. Thank you.

    Read the article

  • Help with these warnings. [inheritance].

    - by sil3nt
    Hello there. I have a set of code, which mimics a basic library cataloging system. There is a base class named items, in which the the general id,title and year variables are defined and 3 other derived classes (DVD,Book and CD). Base [Items] Derived [DVD,Book,CD]. The programs runs, however I get the following warnings, I'm not sure how to fix these. "C:\Program Files\gcc\bin/g++" -Os -mconsole -g -Wall -Wshadow -fno-common mainA4.cpp -o mainA4.exe In file included from mainA4.cpp:5: a4.h: In constructor `DVD::DVD(int, std::string, int, std::string)': a4.h:28: warning: `DVD::director' will be initialized after a4.h:32: warning: base `Items' a4.h:32: warning: when initialized here a4.h: In constructor `Book::Book(int, std::string, int, std::string, int)': a4.h:48: warning: `Book::numPages' will be initialized after a4.h:52: warning: base `Items' a4.h:52: warning: when initialized here a4.h: In constructor `CD::CD(int, std::string, int, std::string, int)': a4.h:66: warning: `CD::numSongs' will be initialized after a4.h:70: warning: base `Items' a4.h:70: warning: when initialized here Exit code: 0

    Read the article

  • left-hand operand of comma has no effect?

    - by sil3nt
    Hello there, I'm having some trouble with this warning message, it is implemented within a template container class int k = 0, l = 0; for ( k =(index+1), l=0; k < sizeC, l < (sizeC-index); k++,l++){ elements[k] = arryCpy[l]; } delete[] arryCpy; this is the warning i get cont.h: In member function `void Container<T>::insert(T, int)': cont.h:99: warning: left-hand operand of comma has no effect cont.h: In member function `void Container<T>::insert(T, int) [with T = double]': a5testing.cpp:21: instantiated from here cont.h:99: warning: left-hand operand of comma has no effect cont.h: In member function `void Container<T>::insert(T, int) [with T = std::string]': a5testing.cpp:28: instantiated from here cont.h:99: warning: left-hand operand of comma has no effect >Exit code: 0

    Read the article

  • cmake: Target-specific preprocessor definitions for CUDA targets seems not to work

    - by Nils
    I'm using cmake 2.8.1 on Mac OSX 10.6 with CUDA 3.0. So I added a CUDA target which needs BLOCK_SIZE set to some number in order to compile. cuda_add_executable(SimpleTestsCUDA SimpleTests.cu BlockMatrix.cpp Matrix.cpp ) set_target_properties(SimpleTestsCUDA PROPERTIES COMPILE_FLAGS -DBLOCK_SIZE=3) When running make VERBOSE=1 I noticed that nvcc is invoked w/o -DBLOCK_SIZE=3, which results in an error, because BLOCK_SIZE is used in the code, but defined nowhere. Now I used the same definition for a CPU target (using add_executable(...)) and there it worked. So now the questions: How do I figure out what cmake does with the set_target_properties line if it points to a CUDA target? Googling around didn't help so far and a workaround would be cool..

    Read the article

  • What is a good platform for building a game framework targetting both web and native languages?

    - by fuzzyTew
    I would like to develop (or find, if one is already in development) a framework with support for accelerated graphics and sound built on a system flexible enough to compile to the following: native ppc/x86/x86_64/arm binaries or a language which compiles to them javascript actionscript bytecode or a language which compiles to it (actionscript 3, haxe) optionally java I imagine, for example, creating an API where I can open windows and make OpenGL-like calls and the framework maps this in a relatively efficient manner to either WebGL with a canvas object, 3d graphics in Flash, OpenGL ES 2 with EGL, or desktop OpenGL in an X11, Windows, or Cocoa window. I have so far looked into these avenues: Building the game library in haXe Pros: Targets exist for php, javascript, actionscript bytecode, c++ High level, object oriented language Cons: No support for finally{} blocks or destructors, making resource cleanup difficult C++ target does not allow room for producing highly optimized libraries -- the foreign function interface requires all primitive types be boxed in a wrapper object, as if writing bindings for a scripting language; these feel unideal for real-time graphics and audio, especially exporting low-level functions. Doesn't seem quite yet mature Using the C preprocessor to create a translator, writing programs entirely with macros Pros: CPP is widespread and simple to use Cons: This is an arduous task and probably the wrong tool for the job CPP implementations differ widely in support for features (e.g. xcode cpp has no variadic macros despite claiming C99 compliance) There is little-to-no room for optimization in this route Using llvm's support for multiple backends to target c/c++ to web languages Pros: Can code in c/c++ LLVM is a very mature highly optimizing compiler performing e.g. global inlining Targets exist for actionscript (alchemy) and javascript (emscripten) Cons: Actionscript target is closed source, unmaintained, and buggy. Javascript targets do not use features of HTML5 for appropriate optimization (e.g. linear memory with typed arrays) and are immature An LLVM target must convert from low-level bytecode, so high-level constructs are lost and bloated unreadable code is created from translating individual instructions, which may be more difficult for an unprepared JIT to optimize. "jump" instructions cause problems for languages with no "goto" statements. Using libclang to write a translator from C/C++ to web languages Pros: A beautiful parsing library providing easy access to the code structure Can code in C/C++ Has sponsored developer effort from Apple Cons: Incomplete; current feature set targets IDEs. Basic operators are unexposed and must be manually parsed from the returned AST element to be identified. Translating code prior to compilation may forgo optimizations assumed in c/c++ such as inlining. Creating new code generators for clang to translate into web languages Pros: Can code in C/C++ as libclang Cons: There is no API; code structure is unstable A much larger job than using libclang; the innards of clang are complex Building the game library in Common Lisp Pros: Flexible, ancient, well-developed language Extensive introspection should ease writing translators Translators exist for at least javascript Cons: Unfamiliar language No standardized library functions, widely varying implementations Which of these avenues should I pursue? Do you know of any others, or any systems that might be useful? Does a general project like this exist somewhere already? Thank you for any input.

    Read the article

  • Android bluetooth socket error

    - by ashwini
    I am using backport bluetooth api on android 1.6. I am using Google Bluetooth Chat sample app for testing. The app works fine in normal scenarios. In a scenario, when I try to connect to paired device which is in off state, I get following error. 01-04 09:00:11.629: ERROR/BluetoothEventLoop.cpp(84): onGetRemoteServiceChannelResult: D-Bus error: org.bluez.Error.ConnectionAttemptFailed (Host is down) 01-04 09:00:11.729: DEBUG/dalvikvm(128): GC freed 4535 objects / 256008 bytes in 296ms 01-04 09:00:21.880: ERROR/bluetooth_RfcommSocket.cpp(1433): connect error: Host is down (112) But it sets the state as connected. The app is unable to catch the exception. Why does it happen? Or is it the case with backport api? Any help is appreciated as I am struggling a lot to get things run fine.

    Read the article

  • static array in c++ forgets its size

    - by Karel Bílek
    In this small example, c++ forgets size of an array, passed to a constructor. I guess it is something simple, but I cannot see it. In classes.h, there is this code: #ifndef CLASSES_INC #define CLASSES_INC #include <iostream> class static_class { public: static_class(int array[]) { std::cout<<sizeof(array)/sizeof(int)<<"\n"; } }; class my_class{ public: static static_class s; static int array[4]; }; #endif In classes.cpp, there is this code: #include "classes.h" int my_class::array[4]={1, 2, 3, 4}; static_class my_class::s = static_class(my_class::array); In main.cpp, there is only simple #include "classes.h" int main () { return 0; } Now, the desired output (from the constructor of static_class) is 4. But what I get is 1. Why is that?

    Read the article

  • AJAX response not valid in C++ but Apache

    - by fehergeri
    I want to make a server written in C++ to power my game. I learned the basics of sockets and wrote a basic chat program that worked well. Now I want to create an HTTP server like Apache, but only for the AJAX request-response part. I think just for the beginning i copied one Apache response text, and i sent the exact response with the C++ server program. The problem that is that the browser (Firefox) connnects to the apache and everything works fine, except all of the requests get a correct response. But if i send this with the C++ client, then FireBug tells me that the response status is OK (200) but there is no actual response text. (How is this possible?) This response-text is exactly the same what apache sends. I made a bit-bit comparison and they were the same. The php file wich is the original response <?php echo "AS";echo rand(0,9); ?> And the origional source code: Socket.h http://pastebin.com/bW9qxtrR Socket.cpp http://pastebin.com/S3c8RFM7 main.cpp http://pastebin.com/ckExuXsR index.html http://pastebin.com/mcfEEqPP < this is the requester file. ajax.js http://pastebin.com/uXJe9hVC benchmark.js http://pastebin.com/djSYtKg9 jQuery is not needed. The main.cpp there is lot of trash code like main3 and main4 functions, these do not affect the result. I know that the response stuff in the C++ code is not really good because the connection closing is not the best; I will fix that later now I want to send a success response first. UPDATE: now i tested today a lot again and i find out there is no problem with the socket. I used the fiddler program to capture the the good answer and to capture the bad. They were the same. After this i turned off my socket application, and forced fiddler to auto respond, and the answer from the 'bad' answer still bat. So after that i replaced the bad with the good and nothing happedned. The bad answer with the good text still bad on the :8888 port but the other on the original :80 port was good, but they were absolutly the same and the same program sended it (fiddler) i think there is something missing if the response is not on the same server address (even not the same port). UPDATE: oh my god! i cant send ajax request to a remote server. now i know this.

    Read the article

  • Abstract classes in shared library

    - by JTom
    Hi, I have an ordinary abstract class that has couple of pure virtual methods. The class itself is a part of the shared library. The compilation of the shared library itself is OK. But when the library is linked to another program that has another class deriving from the abstract one in the shared library and defining the pure virtual methods, I get the following linker error: I compile like this..: g++ -I../path/to/the/library main.cpp derived.cpp -L../path/to/the/library -lsomename -o shared ...and the linker error is: libsomename.so: undefined reference to `AbstractClass::method()' It's like the abstract class cannot access its pure virtual methods but I do not try to make any instance of the abstract class anywhere in the library. What could be the problem?

    Read the article

  • How to auto-include all headers in directory

    - by JRL
    I'm going through exercises of a C++ book. For each exercise I want to minimize the boilerplate code I have to write. I've set up my project a certain way but it doesn't seem right, and requires too many changes. Right now I have a single main.cpp file with the following: #include "e0614.h" int main() { E0614 ex; ex.solve(); } Each time I create a new class from an exercise, I have to come and modify this file to change the name of the included header as well as the class i'm instantiating. So my questions are: Can I include all headers in the directory so at least I don't have to change the #include line? Better yet, can I rewrite my solution so that I don't even have to touch main.cpp, without having one file with all the code for every exercise in it?

    Read the article

  • Is it a good idea to work on header files only, just at the start of the project?

    - by m4design
    To explain my point further, I'm a beginner in programming, and I'm working on a small project. Instead of separating the .cpp file from the header file, I'm implementing the code in the header files, and making one .cpp file for testing. I do this to have less files, hence easier navigation. Then later I'll separate the code as it should be. Will this cause any problems? should I continue doing that? Thanks.

    Read the article

  • initializer_list in the VC10

    - by user335870
    hi i wrote this program in VC++ 2010: class class1 { public: class1 (initializer_list<int> a){}; int foo; float Bar; }; void main() { class1 c = {2,3}; getchar(); } but i get this errors when i compile project: Error 1 error C2552: 'c' : non-aggregates cannot be initialized with initializer list c:\users\pswin\documents\visual studio 2010\projects\test_c++0x\test_c++0x\main.cpp 27 and 2 IntelliSense: initialization with '{...}' is not allowed for object of type "class1" c:\users\pswin\documents\visual studio 2010\projects\test_c++0x\test_c++0x\main.cpp 27 what is the problem?

    Read the article

  • qmake -project command gives QFileInfo warning in Qt 4.6

    - by Pilgrim
    I've upgraded to Qt 4.6 on my Mac (OS 10.5). When I go to a project directory and run: qmake -project Qt returns this warning (although it doesn't say it's a warning, I assume it is since the .pro file gets created anyway): QFileInfo::absolutePath: Constructed with empty filename I did a completely new install thinking that the "upgrade" wasn't clean for whatever reason, it still does it. Any ideas as to why? Here is an example .pro that results from above command: ###################################################################### # Automatically generated by qmake (2.01a) Mon Apr 19 07:39:53 2010 ###################################################################### TEMPLATE = app TARGET = DEPENDPATH += . INCLUDEPATH += . # Input HEADERS += mainwindow.h SOURCES += main.cpp mainwindow.cpp RESOURCES += jquery.qrc

    Read the article

  • declaring a 2D array of pointer objects

    - by Tyler Stennette
    I'm having a tough time figuring out how to instantiate a 2D array of pointer objects. Here is how I'm doing it: Pieces* chessBoard[9][9]; When I want to set it to an actual object pointer, I'm doing the following: chessBoard[1][1] = new Rook(p1Rook); Rook is a class that inherits attributes from the Pieces class and p1Rook is a char variable set to 'R'. This class also implements virtual functions (not pure virtual) from Pieces such as move() or getPiece() that are unique to the particular chess piece. However, when I compile my program, I get the following error: ChessBoard.cpp:69: error: expected type-specifier before ‘Rook’ ChessBoard.cpp:69: error: cannot convert ‘int*’ to ‘Pieces*’ in assignment Can someone please explain what I should change to get rid of this rather annoying persistent error? I would appreciate it.

    Read the article

  • Considering modified files for rebuild

    - by harik
    I have a C++ project, I am using Bakefile for build process, Makefiles are generated for msvc, mingw, gnu etc for cross-platform support. Now the problem is that if I change any .h files (which are included in other .cpp files) and performing a rebuild does not recompile modified files. But changing any .cpp file gets recompiled. Based on modified time-stamp of any file which is included in the project I expect to consider that file for rebuild. Am I missing something which required to be added as a tag in .bkl files? Please help.

    Read the article

  • Using Tortoise SVN with C++ in Visual Studio 2008

    - by Dr. Monkey
    I have an online repository with some .h and .cpp files that make up part of a project. I'm trying to check these out and use them in a new project, but am getting errors (C4627 and C1010). All the files have been added to the project (with AddExisting Item...), and the subdirectories that contain these files have been added to the "Additional include directories" of the project. Would I be better off having the entire project tree in the repository? My reason for not doing so is that my colleague and I are working on different parts of the code and so want to use different main methods to test things as we go, and I didn't see any need to be passing around any compiled code etc. since I assumed that given the .h and .cpp files (with the correct settings), visual studio would be able to compile the project. What's the best way to make Visual Studio 2008 and TortoiseSVN work well together (without spending any money)?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >