Search Results

Search found 1632 results on 66 pages for 'cpp'.

Page 9/66 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • How do I install Dan's Guardian on 12.04?

    - by Matt
    I'm trying to install Dans Guardian on a virtual machine. The instructions ask me to run the ./configure script and then execute the command make install. The configure script runs fine but the make install throws errors. Making all in src make[2]: Entering directory `/webmin/dansguardian-2.10/src' g++ -DHAVE_CONFIG_H -I. -I.. -D__CONFFILE='"/usr/local/etc/dansguardian/dansguardian.conf"' -D__LOGLOCATION='"/usr/local/var/log/dansguardian/"' -D__PIDDIR='"/usr/local/var/run"' -D__PROXYUSER='"nobody"' -D__PROXYGROUP='"nobody"' -D__CONFDIR='"/usr/local/etc/dansguardian"' -g -O2 -MT dansguardian-fancy.o -MD -MP -MF .deps/dansguardian-fancy.Tpo -c -o dansguardian-fancy.o `test -f 'downloadmanagers/fancy.cpp' || echo './'`downloadmanagers/fancy.cpp downloadmanagers/fancy.cpp: In member function âstd::string fancydm::timestring(int)â: downloadmanagers/fancy.cpp:507:72: error: âsnprintfâ was not declared in this scope make[2]: *** [dansguardian-fancy.o] Error 1 make[2]: Leaving directory `/webmin/dansguardian-2.10/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/webmin/dansguardian-2.10' make: *** [all] Error 2 I'm running 12.04 LTS server x64

    Read the article

  • Multiple gcc on Mac OS X

    - by snihalani
    I did a port install for gcc version 4.7.1 (MacPorts gcc47 4.7.1_2) I named the executable as g+ and placed it in one my $PATH. I use gcc 4.7.1 when I need c++11 standard. I haven't changed the original g++ so as not messup XCode. I am using eclipse-cdt and running the make all from the window. It's giving me: 20:12:40 **** Build of configuration Default for project 2804-hw2 **** make all g+ -c -Wall -std=c++11 main.cpp -o main.o make: g+: No such file or directory make: *** [main.o] Error 1 20:12:40 Build Finished (took 89ms) Here is my makefile CC=g+ CFLAGS=-c -Wall -std=c++11 LDFLAGS= SOURCES=main.cpp Vector3D.cpp OBJECTS=$(SOURCES:.cpp=.o) EXECUTABLE=exec all: $(SOURCES) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $@ .cpp.o: $(CC) $(CFLAGS) $< -o $@ clean: rm $(EXECUTABLE) $(OBJECTS) How do I make eclipse detect my g+?

    Read the article

  • Compiling C++ Source code?iostream.h not found?

    - by gabriel
    I do not want to discuss about C++ or any programming language!I just want to know what am i doing wrong with linux ubuntu about compiling helloworld.cpp! I am learning C++ so my steps are: open hello.cpp in vim and write this #include <iostream.h> int main() { cout << "Hello World!\n";` return 0; } So, after that i tried in the terminal this g++ hello.cpp AND the output is hello.cpp:1:22: fatal error: iostream.h: No such file or directory compilation terminated. What do you suggest? Any useful step by step guide for me?Thanks!

    Read the article

  • Dans Guardian install

    - by Matt
    I'm trying to install Dans Guardian on a virtual machine. The instructions ask me to run the ./configure script and then execute the command make install. The configure script runs fine but the make install throws errors. Making all in src make[2]: Entering directory `/webmin/dansguardian-2.10/src' g++ -DHAVE_CONFIG_H -I. -I.. -D__CONFFILE='"/usr/local/etc/dansguardian/dansguardian.conf"' -D__LOGLOCATION='"/usr/local/var/log/dansguardian/"' -D__PIDDIR='"/usr/local/var/run"' -D__PROXYUSER='"nobody"' -D__PROXYGROUP='"nobody"' -D__CONFDIR='"/usr/local/etc/dansguardian"' -g -O2 -MT dansguardian-fancy.o -MD -MP -MF .deps/dansguardian-fancy.Tpo -c -o dansguardian-fancy.o `test -f 'downloadmanagers/fancy.cpp' || echo './'`downloadmanagers/fancy.cpp downloadmanagers/fancy.cpp: In member function âstd::string fancydm::timestring(int)â: downloadmanagers/fancy.cpp:507:72: error: âsnprintfâ was not declared in this scope make[2]: *** [dansguardian-fancy.o] Error 1 make[2]: Leaving directory `/webmin/dansguardian-2.10/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/webmin/dansguardian-2.10' make: *** [all] Error 2 I'm running 12.04 LTS server x64

    Read the article

  • Programming my first C++ program

    - by Jason H.
    I have a basic understanding of programming and I currently learning C++. I'm in the beginning phases of building my own CLI program for ubuntu. However, I have hit a few snags and I was wondering if I could get some clarification. The program I am working on is called "sat" and will be available via command line only. I have the main.cpp. However, my real question is more of a "best practices" for programming/organization. When my program "sat" is invoked I want it to take additional arguments. Here is an example: > sat task subtask I'm not sure if the task should be in its own task.cpp file for better organization or if it should be a function in the main.cpp? If the task should be in its own file how do you accept arguments in the main.cpp file and reference the other file? Any thoughts on which method is preferred and reference material to backup the reasoning?

    Read the article

  • C++ linkage error . What am I doing wrong ? [migrated]

    - by nashmaniac
    So, this is the first time I actually separated a single program into a header and two .cpp files . But I think I am getting an linkage error . Heres how the directory looks . (heres a link to my image I dont have enough rep to post image in the question) http://i.stack.imgur.com/sbT4V.png The main.cpp is my main source file where all the calling functions and other important stuff goes . In functions.cpp I have all my functions , in the coordin.h file I have the function prototypes and structures and Constants . Everything is ok no typo nothing I have checked everything . But I am getting an undefined reference to function error. I have included the coordin.h file too . Do you think the functions.cpp file needs to go somewhere else I mean is the compiler not looking inside that file ? Thanks !

    Read the article

  • What to do if I hate C++ header files?

    - by BlaXpirit
    I was always confused about header files. They are so strange: you include .h file which doesn't include .cpp but .cpp are somehow compiled too. NOTE: I UNDERSTAND EVERYTHING ABOUT THE HEADERS, PLEASE DON'T TELL ME I'M STUPID OR SHOULD USE OTHER LANGUAGE Recently I joined a team project, and of course, both .h and .cpp are used. I understand that this is very important, but I can't live with copy-pasting every function declaration in each of multiple classes we have. How do I handle the 2-file convention efficiently? Are there any tools to help with that, or automatically change one file that looks like example below to .h and .cpp? (specifically for MS VC++ 2010) class A { ... Type f(Type a,Type b) { //implementation here, not in another file! } ... }; Type f(Type a) { //implementation here } ...

    Read the article

  • Linux C++: Linker is outputting strange errors

    - by knight666
    Alright, here is the output I get: arm-none-linux-gnueabi-ld --entry=main -dynamic-linker=/system/bin/linker -rpath-link=/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib -L/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib -nostdlib -lstdc++ -lm -lGLESv1_CM -rpath=/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib -rpath=../../YoghurtGum/lib/Android -L./lib/Android intermediate/Alien.o intermediate/Bullet.o intermediate/Game.o intermediate/Player.o ../../YoghurtGum/bin/YoghurtGum.a -o bin/Galaxians.android intermediate/Game.o: In function `Galaxians::Init()': /media/YoghurtGum/Tests/Galaxians/src/Game.cpp:45: undefined reference to `__cxa_end_cleanup' /media/YoghurtGum/Tests/Galaxians/src/Game.cpp:44: undefined reference to `__cxa_end_cleanup' intermediate/Game.o:(.ARM.extab+0x18): undefined reference to `__gxx_personality_v0' intermediate/Game.o: In function `Player::Update()': /media/YoghurtGum/Tests/Galaxians/src/Player.h:41: undefined reference to `__cxa_end_cleanup' intermediate/Game.o:(.ARM.extab.text._ZN6Player6UpdateEv[_ZN6Player6UpdateEv]+0x0): undefined reference to `__gxx_personality_v0' intermediate/Game.o:(.rodata._ZTIN10YoghurtGum4GameE[_ZTIN10YoghurtGum4GameE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info' intermediate/Game.o:(.rodata._ZTI6Player[_ZTI6Player]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' intermediate/Game.o:(.rodata._ZTIN10YoghurtGum6EntityE[_ZTIN10YoghurtGum6EntityE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' intermediate/Game.o:(.rodata._ZTIN10YoghurtGum6ObjectE[_ZTIN10YoghurtGum6ObjectE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info' intermediate/Game.o:(.rodata._ZTI6Bullet[_ZTI6Bullet]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' intermediate/Game.o:(.rodata._ZTI5Alien[_ZTI5Alien]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' intermediate/Game.o:(.rodata+0x20): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' ../../YoghurtGum/bin/YoghurtGum.a(Sprite.o):(.rodata._ZTIN10YoghurtGum16SpriteDataOpenGLE[_ZTIN10YoghurtGum16SpriteDataOpenGLE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' ../../YoghurtGum/bin/YoghurtGum.a(Sprite.o):(.rodata._ZTIN10YoghurtGum10SpriteDataE[_ZTIN10YoghurtGum10SpriteDataE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info' make: *** [bin/Galaxians.android] Fout 1 Here's an error I managed to decipher: intermediate/Game.o: In function `Galaxians::Init()': /media/YoghurtGum/Tests/Galaxians/src/Game.cpp:45: undefined reference to `__cxa_end_cleanup' /media/YoghurtGum/Tests/Galaxians/src/Game.cpp:44: undefined reference to `__cxa_end_cleanup' This is line 43 through 45: Assets::AddSprite(new Sprite("media\\ViperMarkII.bmp"), "ship"); Assets::AddSprite(new Sprite("media\\alien.bmp"), "alien"); Assets::AddSprite(new Sprite("media\\bat_ball.bmp"), "bullet"); So, what seems funny to me is that the first new is fine (line 43), but the second one isn't. What could cause this? intermediate/Game.o: In function `Player::Update()': /media/YoghurtGum/Tests/Galaxians/src/Player.h:41: undefined reference to `__cxa_end_cleanup' Another issue with new: Engine::game->scene_current->AddObject(new Bullet(m_X + 10, m_Y)); I have no idea where to begin with the other issues. These are my makefiles, They're a giant mess because I'm just trying to get it to work. Static library: # ====================================== # # # # YoghurtGum static library # # # # ====================================== # include ../YoghurtGum.mk PROGS = bin/YoghurtGum.a SOURCES = $(wildcard src/*.cpp) #$(YG_PATH_LIB)/libGLESv1_CM.so \ #$(YG_PATH_LIB)/libEGL.so \ YG_LINK_OPTIONS = -shared YG_LIBRARIES = \ $(YG_PATH_LIB)/libc.a \ $(YG_PATH_LIB)/libc.so \ $(YG_PATH_LIB)/libstdc++.a \ $(YG_PATH_LIB)/libstdc++.so \ $(YG_PATH_LIB)/libm.a \ $(YG_PATH_LIB)/libm.so \ $(YG_PATH_LIB)/libui.so \ $(YG_PATH_LIB)/liblog.so \ $(YG_PATH_LIB)/libGLESv2.so \ $(YG_PATH_LIB)/libcutils.so \ YG_OBJECTS = $(patsubst src/%.cpp, $(YG_INT)/%.o, $(SOURCES)) YG_NDK_PATH_LIB = /home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib all: $(PROGS) rebuild: clean $(PROGS) # remove all .o objects from intermediate and all .android objects from bin clean: rm -f $(YG_INT)/*.o $(YG_BIN)/*.a copy: acpy ../$(PROGS) $(PROGS): $(YG_OBJECTS) $(YG_ARCHIVER) -vq $(PROGS) $(YG_NDK_PATH_LIB)/crtbegin_static.o $(YG_NDK_PATH_LIB)/crtend_android.o $^ && \ $(YG_ARCHIVER) -vr $(PROGS) $(YG_LIBRARIES) $(YG_OBJECTS): $(YG_INT)/%.o : $(YG_SRC)/%.cpp $(YG_COMPILER) $(YG_FLAGS) -I $(GLES_INCLUDES) -c $< -o $@ Test game project: # ====================================== # # # # Galaxians # # # # ====================================== # include ../../YoghurtGum.mk PROGS = bin/Galaxians.android YG_COMPILER = arm-none-linux-gnueabi-g++ YG_LINKER = arm-none-linux-gnueabi-ld YG_PATH_LIB = ./lib/Android YG_LIBRARIES = ../../YoghurtGum/bin/YoghurtGum.a YG_PROGS = bin/Galaxians.android GLES_INCLUDES = ../../YoghurtGum/src ANDROID_NDK_ROOT = /home/oem/android-ndk-r3 NDK_PLATFORM_VER = 5 YG_NDK_PATH_LIB = $(ANDROID_NDK_ROOT)/build/platforms/android-$(NDK_PLATFORM_VER)/arch-arm/usr/lib YG_LIBS = -nostdlib -lstdc++ -lm -lGLESv1_CM #YG_COMPILE_OPTIONS = -g -rdynamic -Wall -Werror -O2 -w YG_COMPILE_OPTIONS = -g -Wall -Werror -O2 -w YG_LINK_OPTIONS = --entry=main -dynamic-linker=/system/bin/linker -rpath-link=$(YG_NDK_PATH_LIB) -L$(YG_NDK_PATH_LIB) $(YG_LIBS) SOURCES = $(wildcard src/*.cpp) YG_OBJECTS = $(patsubst src/%.cpp, intermediate/%.o, $(SOURCES)) all: $(PROGS) rebuild: clean $(PROGS) clean: rm -f intermediate/*.o bin/*.android $(PROGS): $(YG_OBJECTS) $(YG_LINKER) $(YG_LINK_OPTIONS) -rpath=$(YG_NDK_PATH_LIB) -rpath=../../YoghurtGum/lib/Android -L$(YG_PATH_LIB) $^ $(YG_LIBRARIES) -o $@ $(YG_OBJECTS): intermediate/%.o : src/%.cpp $(YG_COMPILER) $(YG_COMPILE_OPTIONS) -I ../../YoghurtGum/src/GLES -I ../../YoghurtGum/src -c $< -o $@ Any help would be appreciated.

    Read the article

  • Dynamic loaded libraries and shared global symbols

    - by phlipsy
    Since I observed some strange behavior of global variables in my dynamically loaded libraries, I wrote the following test. At first we need a statically linked library: The header test.hpp #ifndef __BASE_HPP #define __BASE_HPP #include <iostream> class test { private: int value; public: test(int value) : value(value) { std::cout << "test::test(int) : value = " << value << std::endl; } ~test() { std::cout << "test::~test() : value = " << value << std::endl; } int get_value() const { return value; } void set_value(int new_value) { value = new_value; } }; extern test global_test; #endif // __BASE_HPP and the source test.cpp #include "base.hpp" test global_test = test(1); Then I wrote a dynamically loaded library: library.cpp #include "base.hpp" extern "C" { test* get_global_test() { return &global_test; } } and a client program loading this library: client.cpp #include <iostream> #include <dlfcn.h> #include "base.hpp" typedef test* get_global_test_t(); int main() { global_test.set_value(2); // global_test from libbase.a std::cout << "client: " << global_test.get_value() << std::endl; void* handle = dlopen("./liblibrary.so", RTLD_LAZY); if (handle == NULL) { std::cout << dlerror() << std::endl; return 1; } get_global_test_t* get_global_test = NULL; void* func = dlsym(handle, "get_global_test"); if (func == NULL) { std::cout << dlerror() << std::endl; return 1; } else get_global_test = reinterpret_cast<get_global_test_t*>(func); test* t = get_global_test(); // global_test from liblibrary.so std::cout << "liblibrary.so: " << t->get_value() << std::endl; std::cout << "client: " << global_test.get_value() << std::endl; dlclose(handle); return 0; } Now I compile the statically loaded library with g++ -Wall -g -c base.cpp ar rcs libbase.a base.o the dynamically loaded library g++ -Wall -g -fPIC -shared library.cpp libbase.a -o liblibrary.so and the client g++ -Wall -g -ldl client.cpp libbase.a -o client Now I observe: The client and the dynamically loaded library possess a different version of the variable global_test. But in my project I'm using cmake. The build script looks like this: CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(globaltest) ADD_LIBRARY(base STATIC base.cpp) ADD_LIBRARY(library MODULE library.cpp) TARGET_LINK_LIBRARIES(library base) ADD_EXECUTABLE(client client.cpp) TARGET_LINK_LIBRARIES(client base dl) analyzing the created makefiles I found that cmake builds the client with g++ -Wall -g -ldl -rdynamic client.cpp libbase.a -o client This ends up in a slightly different but fatal behavior: The global_test of the client and the dynamically loaded library are the same but will be destroyed two times at the end of the program. Am I using cmake in a wrong way? Is it possible that the client and the dynamically loaded library use the same global_test but without this double destruction problem?

    Read the article

  • forward/strong enum in VS2010

    - by Noah Roberts
    At http://blogs.msdn.com/vcblog/archive/2010/04/06/c-0x-core-language-features-in-vc10-the-table.aspx there is a table showing C++0x features that are implemented in 2010 RC. Among them are listed forwarding enums and strongly typed enums but they are listed as "partial". The main text of the article says that this means they are either incomplete or implemented in some non-standard way. So I've got VS2010RC and am playing around with the C++0x features. I can't figure these ones out and can't find any documentation on these two features. Not even the simplest attempts compile. enum class E { test }; int main() {} fails with: 1e:\dev_workspace\experimental\2010_feature_assessment\2010_feature_assessment\main.cpp(518): error C2332: 'enum' : missing tag name 1e:\dev_workspace\experimental\2010_feature_assessment\2010_feature_assessment\main.cpp(518): error C2236: unexpected 'class' 'E'. Did you forget a ';'? 1e:\dev_workspace\experimental\2010_feature_assessment\2010_feature_assessment\main.cpp(518): error C3381: 'E' : assembly access specifiers are only available in code compiled with a /clr option 1e:\dev_workspace\experimental\2010_feature_assessment\2010_feature_assessment\main.cpp(518): error C2143: syntax error : missing ';' before '}' 1e:\dev_workspace\experimental\2010_feature_assessment\2010_feature_assessment\main.cpp(518): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== int main() { enum E : short; } Fails with: 1e:\dev_workspace\experimental\2010_feature_assessment\2010_feature_assessment\main.cpp(513): warning C4480: nonstandard extension used: specifying underlying type for enum 'main::E' 1e:\dev_workspace\experimental\2010_feature_assessment\2010_feature_assessment\main.cpp(513): error C2059: syntax error : ';' ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== So it seems it must be some totally non-standard implementation that has allowed them to justify calling this feature "partially" done. How would I rewrite that code to access the forwarding and strong type feature?

    Read the article

  • Academic question: typename

    - by Arman
    Hi, recently I accounted with a "simple problem" of porting code from VC++ to gcc/intel. The code is compiles w/o error on VC++: #include <vector> using std::vector; template <class T> void test_vec( std::vector<T> &vec) { typedef std::vector<T> M; /*==> add here typename*/ M::iterator ib=vec.begin(),ie=vec.end(); }; int main() { vector<double> x(100, 10); test_vec<double>(x); return 0; } then with g++ we have some unclear errors: g++ t.cpp t.cpp: In function 'void test_vec(std::vector<T, std::allocator<_CharT> >&)': t.cpp:13: error: expected `;' before 'ie' t.cpp: In function 'void test_vec(std::vector<T, std::allocator<_CharT> >&) [with T = double]': t.cpp:18: instantiated from here t.cpp:12: error: dependent-name 'std::M::iterator' is parsed as a non-type, but instantiation yields a type t.cpp:12: note: say 'typename std::M::iterator' if a type is meant If we add typename before iterator the code will compile w/o pb. If it is possible to make a compiler which can understand the code written in the more "natural way", then for me is unclear why we should add typename? Which rules of "C++ standards"(if there are some) will be broken if we allow all compilers to use without "typename"? kind regards Arman.

    Read the article

  • Compile C++ file as objective-c++ using makefile

    - by Vikas
    I'm trying to compile .cpp files as objective-c++ using makefile as few of my cpp file have objective code. I added -x objective-c++ as complier option and started getting stray /327 in program error( and lots of similar error with different numbers after /). The errors are around 200. But when I change the encoding of the file from unicode-8 to 16 the error reduces to 23. currently there is no objective-c++ code in the .cpp file but plan to add in future. When i remove -x objective-c++ from complier option ,everything complies fine. and .out is generated. I would be helpful if someone will tell me why this is happening and even a solution for the same Thanks in advance example of my makefile <code> MACHINE= $(shell uname -s) CFLAGS?=-w -framework CoreServices -framework ApplicationServices -framework CoreFoundation -framework CoreWLAN -framework Cocoa -framework Foundation ifeq ($(MACHINE),Darwin) CCLINK?= -lpthread else CCLINK?= -lpthread -lrt endif DEBUG?= -g -rdynamic -ggdb CCOPT= $(CFLAGS) $(ARCH) $(PROF) CC =g++ -x objective-c++ AR = ar rcs #lib name SLIB_NAME=myapplib EXENAME = myapp.out OBJDIR = build OBJLIB := $(addprefix $(OBJDIR)/... all .o files) SS_OBJ := $(addprefix $(OBJDIR)/,myapp.o ) vpath %.cpp path to my .cpp files INC = include files subsystem: make all $(OBJLIB) : |$(OBJDIR) $(OBJDIR): mkdir $(OBJDIR) $(OBJDIR)/%.o:%.cpp $(CC) -c $(INC) $(CCOPT) $(DEBUG) $(CCLINK) $< -o $@ all: $(OBJLIB) $(CLI_OBJ) $(SS_OBJ) $(AR) lib$(SLIB_NAME).a $(OBJLIB) $(CC) $(INC) $(CCOPT) $(SS_OBJ) $(DEBUG) $(CCLINK) -l$(SLIB_NAME) -L ./ -o $(OBJDIR)/$(EXENAME) clean: rm -rf $(OBJDIR)/* dep: $(CC) -MM *.cpp </code>

    Read the article

  • stdexcept On Android

    - by David R.
    I'm trying to compile SoundTouch on Android. I started with this configure line: ./configure CPPFLAGS="-I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/" LDFLAGS="-Wl,-rpath-link=/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/lib -L/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/lib -nostdlib -lc" --host=arm-eabi --enable-shared=yes CFLAGS="-nostdlib -O3 -mandroid" host_alias=arm-eabi --no-create --no-recursion Because the Android NDK targets ARM, I also had to change the Makefile to remove the -msse2 flags to progress. When I run 'make', I get: /bin/sh ../../libtool --tag=CXX --mode=compile arm-eabi-g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/ -O3 -fcheck-new -I../../include -g -O2 -MT FIRFilter.lo -MD -MP -MF .deps/FIRFilter.Tpo -c -o FIRFilter.lo FIRFilter.cpp libtool: compile: arm-eabi-g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/ -O3 -fcheck-new -I../../include -g -O2 -MT FIRFilter.lo -MD -MP -MF .deps/FIRFilter.Tpo -c FIRFilter.cpp -o FIRFilter.o FIRFilter.cpp:46:21: error: stdexcept: No such file or directory FIRFilter.cpp: In member function 'virtual void soundtouch::FIRFilter::setCoefficients(const soundtouch::SAMPLETYPE*, uint, uint)': FIRFilter.cpp:177: error: 'runtime_error' is not a member of 'std' FIRFilter.cpp: In static member function 'static void* soundtouch::FIRFilter::operator new(size_t)': FIRFilter.cpp:225: error: 'runtime_error' is not a member of 'std' make[2]: *** [FIRFilter.lo] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all-recursive] Error 1 This isn't very surprising, since the -nostdlib flag was required. Android seems to have neither stdexcept nor stdlib. How can I get past this block of compiling SoundTouch? At a guess, there may be some flag I don't know about that I should use. I could refactor the code not to use stdexcept. There may be a way to pull in the original stdexcept source and reference that. I might be able to link to a precompiled stdexcept library.

    Read the article

  • Problems compiliing c++ code using cygwin

    - by user343403
    I am trying to compile some source code in cygwin (in windows 7) and get the following error when I run the make file g++ -DHAVE_CONFIG_H -I. -I.. -I.. -Wall -Wextra -Werror -g -O2 -MT libcommon_a Fcntl.o -MD -MP -MF .deps/libcommon_a-Fcntl.Tpo -c -o libcommon_a-Fcntl.o `test -f 'Fcntl.cpp' || echo './'`Fcntl.cpp Fcntl.cpp: In function int setCloexec(int): Fcntl.cpp:8: error: 'F_GETFD' was not declared in this scope Fcntl.cpp:8: error: 'fcntl' was not declared in this scope Fcntl.cpp:11: error: 'FD_CLOEXEC' was not declared in this scope Fcntl.cpp:12: error: 'F_SETFD' was not declared in this scope make[4]: *** [libcommon_a-Fcntl.o] Error 1 make[4]: Leaving directory `/abyss-1.1.2/Common' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/abyss-1.1.2' make[2]: *** [all] Error 2 make[2]: Leaving directory `/abyss-1.1.2' make[1]: *** [.build-conf] Error 2 make[1]: Leaving directory `/cygdrive/c/Users/Martin/Documents/NetBeansProjects/abyss-1.1.2_1' make: *** [.build-impl] Error 2 The problem file is:- #include "Fcntl.h" #include <fcntl.h> /* Set the FD_CLOEXEC flag of the specified file descriptor. */ int setCloexec(int fd) { int flags = fcntl(fd, F_GETFD, 0); if (flags == -1) return -1; flags |= FD_CLOEXEC; return fcntl(fd, F_SETFD, flags); } I don't understand what is going on, the file fcntl.h is available and the varaiables that it says were not declared in this scope do not give an error when I compile the file on its own Any help would be much appreciated Many Thanks

    Read the article

  • Boost Date_Time problem compiling a simple program

    - by Andry
    Hello! I'm writing a very stupid program using Boost Date_Time library. int main(int srgc, char** argv) { using namespace boost::posix_time; date d(2002,Feb,1); //an arbitrary date ptime t1(d, hours(5)+nanosec(100)); //date + time of day offset ptime t2 = t1 - minutes(4)+seconds(2); ptime now = second_clock::local_time(); //use the clock date today = now.date(); //Get the date part out of the time } Well I cannot compile it, compiler does not recognize a type... Well I used many features of Boost libs like serialization and more... I correctly built them and, looking in my /usr/local/lib folder I can see that libboost_date_time.so is there (a good sign which means I was able to build that library) When I compile I write the following: g++ -lboost_date_time main.cpp But the errors it showed me when I specify the lib are the same of those ones where I do not specify any lib. What is this? Anyone knows? The error is main.cpp: In function ‘int main(int, char**)’: main.cpp:9: error: ‘date’ was not declared in this scope main.cpp:9: error: expected ‘;’ before ‘d’ main.cpp:10: error: ‘d’ was not declared in this scope main.cpp:10: error: ‘nanosec’ was not declared in this scope main.cpp:13: error: expected ‘;’ before ‘today’

    Read the article

  • C++ function overloading and dynamic binding compile problem

    - by Olorin
    #include <iostream> using namespace std; class A { public: virtual void foo(void) const { cout << "A::foo(void)" << endl; } virtual void foo(int i) const { cout << i << endl; } virtual ~A() {} }; class B : public A { public: void foo(int i) const { this->foo(); cout << i << endl; } }; class C : public B { public: void foo(void) const { cout << "C::foo(void)" << endl; } }; int main(int argc, char ** argv) { C test; test.foo(45); return 0; } The above code does not compile with: $>g++ test.cpp -o test.exe test.cpp: In member function 'virtual void B::foo(int) const': test.cpp:17: error: no matching function for call to 'B::foo() const' test.cpp:17: note: candidates are: virtual void B::foo(int) const test.cpp: In function 'int main(int, char**)': test.cpp:31: error: no matching function for call to 'C::foo(int)' test.cpp:23: note: candidates are: virtual void C::foo() const It compiles if method "foo(void)" is changed to "goo(void)". Why is this so? Is it possible to compile the code without changing the method name of "foo(void)"? Thanks.

    Read the article

  • Makefile - Dependency generation

    - by Profetylen
    I am trying to create a makefile that automatically compiles and links my .cpp files into an executable via .o files. What I can't get working is automated (or even manual) dependency generation. When i uncomment the below commented code, nothing is recompiled when i run make build. All i get is make: Nothing to be done for 'build'., even if x.h (or any .h file) has changed. I've been trying to learn from this question: Makefile, header dependencies, dmckee's answer, especially. Why isn't this makefile working? Clarification: I can compile everything, but when I modify any header file, the .cpp files that depend on it aren't updated. So, if I for instance compile my entire source, then I change a #define in the header file, and then run make build, and I get Nothing to be done for 'build'. (when I have uncommented either commented chunks of the below code). CC=gcc CFLAGS=-O2 -Wall LDFLAGS=-lSDL -lstdc++ SOURCES=$(wildcard *.cpp) OBJECTS=$(patsubst %.cpp, obj/%.o,$(SOURCES)) TARGET=bin/test.bin # Nothing happens when i uncomment the following. (automated attempt) #depend: .depend # #.depend: $(SOURCES) # rm -f ./.depend # $(CC) $(CFLAGS) -MM $^ >> ./.depend; # #include .depend # And nothing happens when i uncomment the following. x.cpp and x.h are files in my project. (manual attempt) #x.o: x.cpp x.h clean: rm -f $(TARGET) rm -f $(OBJECTS) run: build ./$(TARGET) debug: build nm $(TARGET) gdb $(TARGET) build: $(TARGET) $(TARGET): $(OBJECTS) @mkdir -p $(@D) $(CC) $(LDFLAGS) $(OBJECTS) -o $@ obj/%.o: %.cpp @mkdir -p $(@D) $(CC) -c $(CFLAGS) $< -o $@ include $(DEPENDENCIES)

    Read the article

  • Is ther a Designer for MFC in Visual Studio like for windows forms in .NET?

    - by claws
    Hello, I'm a .NET programmer. I've never developed anything in MFC. Currently I had to write a C++ application (console) for some image processing task. I finished writing it. But the point is I need to design GUI also for this. Well, there won't be anything complex. Just a window with few Buttons, RadioButtons, Check Boxes, PicturesBox & few sliders. thats it. I'm using VS 2008 and was expecting a .NET style form designer. Just to test, I created a MFC project (with all default configuration) and these files were created by default: ChildFrm.cpp MainFrm.cpp mfc.cpp mfcDoc.cpp mfcView.cpp stdafx.cpp Now, I'm unable to find a Designer. There is no View Designer. I've opened all the above *.cpp and in the code editor right clicked to see "Designer View". ToolBox is just empty because I'm in code editor mode. When I built the project. This is the window I get. How to open a designer?

    Read the article

  • Why we can't we overload "=" using friend function?

    - by ashish-sangwan
    Why it is not allowed to overload "=" using friend function? I have written a small program but it is giving error. class comp { int real; int imaginary; public: comp(){real=0; imaginary=0;} void show(){cout << "Real="<<real<<" Imaginary="<<imaginary<<endl;} void set(int i,int j){real=i;imaginary=j;} friend comp operator=(comp &op1,const comp &op2); }; comp operator=(comp &op1,const comp &op2) { op1.imaginary=op2.imaginary; op1.real=op2.real; return op1; } int main() { comp a,b; a.set(10,20); b=a; b.show(); return 0; } The compilation gives the following error :- [root@dogmatix stackoverflow]# g++ prog4.cpp prog4.cpp:11: error: ‘comp operator=(comp&, const comp&)’ must be a nonstatic member function prog4.cpp:14: error: ‘comp operator=(comp&, const comp&)’ must be a nonstatic member function prog4.cpp: In function ‘int main()’: prog4.cpp:25: error: ambiguous overload for ‘operator=’ in ‘b = a’ prog4.cpp:4: note: candidates are: comp& comp::operator=(const comp&) prog4.cpp:14: note: comp operator=(comp&, const comp&)

    Read the article

  • Is there a Designer for MFC in Visual Studio like for windows forms in .NET?

    - by claws
    I'm a .NET programmer. I've never developed anything in MFC. Currently I had to write a C++ application (console) for some image processing task. I finished writing it. But the point is I need to design GUI also for this. Well, there won't be anything complex. Just a window with few Buttons, RadioButtons, Check Boxes, PicturesBox & few sliders. thats it. I'm using VS 2008 and was expecting a .NET style form designer. Just to test, I created a MFC project (with all default configuration) and these files were created by default: ChildFrm.cpp MainFrm.cpp mfc.cpp mfcDoc.cpp mfcView.cpp stdafx.cpp Now, I'm unable to find a Designer. There is no View Designer. I've opened all the above *.cpp and in the code editor right clicked to see "Designer View". ToolBox is just empty because I'm in code editor mode. When I built the project. This is the window I get. How to open a designer?

    Read the article

  • Function returning pointer to struct

    - by GammaGuy
    I am having some issues with code that is returning a pointer to a struct declared inside a class. Here is my code so far: SortedList.h #ifndef SORTEDLIST_H #define SORTEDLIST_H class SortedList{ public: SortedList(); ... private: struct Listnode { Student *student; Listnode *next; }; static Listnode *copyList (Listnode *L); }; #endif SortedList.cpp #include "SortedList.h" ... // Here is where the problem lies Listnode SortedList::*copyList(Listnode *L) { return 0; // for NULL } Apparently, the copy list method wont compile. I am using Microsoft Visual Studio and the compiler tells me that "Listnode" is unidentified. When I try to compile, here is whhat I get: 1>------ Build started: Project: Program3, Configuration: Debug Win32 ------ 1> SortedList.cpp 1>c:\users\owner\documents\college\fall 2012\cs 368 - learn c++\program3\program3\sortedlist.cpp(159): error C2657: 'SortedList::*' found at the start of a statement (did you forget to specify a type?) 1>c:\users\owner\documents\college\fall 2012\cs 368 - learn c++\program3\program3\sortedlist.cpp(159): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\owner\documents\college\fall 2012\cs 368 - learn c++\program3\program3\sortedlist.cpp(159): error C2065: 'L' : undeclared identifier 1>c:\users\owner\documents\college\fall 2012\cs 368 - learn c++\program3\program3\sortedlist.cpp(159): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\owner\documents\college\fall 2012\cs 368 - learn c++\program3\program3\sortedlist.cpp(159): fatal error C1903: unable to recover from previous error(s); stopping compilation ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Help would be greatly appreciated...ASAP

    Read the article

  • Unable to write DVD-R(Blank DVD's)

    - by FrozenKing
    I have a problem in dvd drive i.e. It can read CD/DVD and can write CD and all CD/DVD-RW but cannot write DVD DVD drive model is SH-S203B Samsung; I also have a log file created by nero burning rom 11. Actually the fact is no Blank DVD's are being read in my dvd drive only previously written dvd's can be read! Is this the problem of OS or should I try cleaning the dvd drive or my DVD drive is 4yrs old so is it going to spoil now, since it is showing this type of symptoms! OS = WinXP AV = KIS 2012 DVD Drive = Samsung SH-S203B (Also tried latest firmware and downgrade versions also) IA32 Nero Version: 11.2.4.100 Internal Version: 11,2,4,100 Recorder: <TSSTcorp CDDVDW SH-S203B>Version: SB04 - HA 1 TA 0 - 11.2.4.100 Adapter driver: <Serial ATA> HA 1 Drive buffer : 2048kB Bus Type : via Inquiry data CD-ROM: <TSSTcorp CDDVDW SH-S203B >Version: SB04 - HA 1 TA 0 - 11.2.4.100 Adapter driver: <Serial ATA> HA 1 18:58:10 #37 SPTI -1511 File SCSIPassThrough.cpp, Line 224 CdRom0: SCSIStatus(x02) WinError(0) NeroError(-1511) CDB Data: 0x28 00 00 00 00 00 00 00 10 00 Sense Key: 0x04 (KEY_HARDWARE_ERROR) Sense Code: 0x3E Sense Qual: 0x02 Sense Area: 0x70 00 04 00 00 00 00 0A 00 00 00 00 3E 02 Buffer x08047340: Len x8000 18:58:10 #38 SectorVerify 20 File Cdrdrv.cpp, Line 12057 Read errors from sector 0 to 14 <Padding> 18:58:19 #39 SPTI -1511 File SCSIPassThrough.cpp, Line 224 CdRom0: SCSIStatus(x02) WinError(0) NeroError(-1511) CDB Data: 0x28 00 00 00 00 10 00 00 10 00 Sense Key: 0x04 (KEY_HARDWARE_ERROR) Sense Code: 0x3E Sense Qual: 0x02 Sense Area: 0x70 00 04 00 00 00 00 0A 00 00 00 00 3E 02 Buffer x08047340: Len x8000 18:58:19 #40 SectorVerify 21 File Cdrdrv.cpp, Line 12057 Read error at sector 15 <Virtual Multisession Info> 18:58:19 #41 SectorVerify 20 File Cdrdrv.cpp, Line 12057 Read errors from sector 16 to 18 <Volume Structure Descriptor Sequence> 18:58:28 #42 SPTI -1511 File SCSIPassThrough.cpp, Line 224 CdRom0: SCSIStatus(x02) WinError(0) NeroError(-1511) CDB Data: 0x28 00 00 00 00 20 00 00 10 00 Sense Key: 0x04 (KEY_HARDWARE_ERROR) Sense Code: 0x3E Sense Qual: 0x02 Sense Area: 0x70 00 04 00 00 00 00 0A 00 00 00 00 3E 02 Buffer x08047340: Len x8000

    Read the article

  • gcc precompiled headers weird behaviour with -c option

    - by pachanga
    Folks, I'm using gcc-4.4.1 on Linux and before trying precompiled headers in a really large project I decided to test them on simple program. They "kinda work" but I'm not happy with results and I'm sure there is something wrong about my setup. First of all, I wrote a simple program(main.cpp) to test if they work at all: #include <boost/bind.hpp> #include <boost/function.hpp> #include <boost/type_traits.hpp> int main() { return 0; } Then I created the precompiled headers file pre.h(in the same directory) as follows: #include <boost/bind.hpp> #include <boost/function.hpp> #include <boost/type_traits.hpp> ...and compiled it: $ g++ -I. pre.h (pre.h.gch was created) After that I measured compile time with and without precompiled headers: with pch $ time g++ -I. -include pre.h main.cpp real 0m0.128s user 0m0.088s sys 0m0.048s without pch $ time g++ -I. main.cpp real 0m0.838s user 0m0.784s sys 0m0.056s So far so good! Almost 7 times faster, that's impressive! Now let's try something more realistic. All my sources are built with -c option and for some reason I can't make pch play nicely with it. You can reproduce this with the following steps below... I created the test module foo.cpp as follows: #include <boost/bind.hpp> #include <boost/function.hpp> #include <boost/type_traits.hpp> int whatever() { return 0; } Here are the timings of my attempts to build the module foo.cpp with and without pch: with pch $ time g++ -I. -include pre.h -c foo.cpp real 0m0.357s user 0m0.348s sys 0m0.012s without pch $ time g++ -I. -c foo.cpp real 0m0.330s user 0m0.292s sys 0m0.044s That's quite strange, looks like there is no speed up at all!(I ran timings for several times). It turned out precompiled headers were not used at all in this case, I checked it with -H option(output of "g++ -I. -include pre.h -c foo.cpp -H" didn't list pre.h.gch at all). What am I doing wrong?

    Read the article

  • Mixing policy-based design with CRTP in C++

    - by Eitan
    I'm attempting to write a policy-based host class (i.e., a class that inherits from its template class), with a twist, where the policy class is also templated by the host class, so that it can access its types. One example where this might be useful is where a policy (used like a mixin, really), augments the host class with a polymorphic clone() method. Here's a minimal example of what I'm trying to do: template <template <class> class P> struct Host : public P<Host<P> > { typedef P<Host<P> > Base; typedef Host* HostPtr; Host(const Base& p) : Base(p) {} }; template <class H> struct Policy { typedef typename H::HostPtr Hptr; Hptr clone() const { return Hptr(new H((Hptr)this)); } }; Policy<Host<Policy> > p; Host<Policy> h(p); int main() { return 0; } This, unfortunately, fails to compile, in what seems to me like circular type dependency: try.cpp: In instantiation of ‘Host<Policy>’: try.cpp:10: instantiated from ‘Policy<Host<Policy> >’ try.cpp:16: instantiated from here try.cpp:2: error: invalid use of incomplete type ‘struct Policy<Host<Policy> >’ try.cpp:9: error: declaration of ‘struct Policy<Host<Policy> >’ try.cpp: In constructor ‘Host<P>::Host(const P<Host<P> >&) [with P = Policy]’: try.cpp:17: instantiated from here try.cpp:5: error: type ‘Policy<Host<Policy> >’ is not a direct base of ‘Host<Policy>’ If anyone can spot an obvious mistake, or has successfuly mixing CRTP in policies, I would appreciate any help.

    Read the article

  • Catching an exception class within a template

    - by Todd Bauer
    I'm having a problem using the exception class Overflow() for a Stack template I'm creating. If I define the class regularly there is no problem. If I define the class as a template, I cannot make my call to catch() work properly. I have a feeling it's simply syntax, but I can't figure it out for the life of me. #include<iostream> #include<exception> using namespace std; template <class T> class Stack { private: T *stackArray; int size; int top; public: Stack(int size) { this->size = size; stackArray = new T[size]; top = 0; } ~Stack() { delete[] stackArray; } void push(T value) { if (isFull()) throw Overflow(); stackArray[top] = value; top++; } bool isFull() { if (top == size) return true; else return false; } class Overflow {}; }; int main() { try { Stack<double> Stack(5); Stack.push( 5.0); Stack.push(10.1); Stack.push(15.2); Stack.push(20.3); Stack.push(25.4); Stack.push(30.5); } catch (Stack::Overflow) { cout << "ERROR! The stack is full.\n"; } return 0; } The problem is in the catch (Stack::Overflow) statement. As I said, if the class is not a template, this works just fine. However, once I define it as a template, this ceases to work. I've tried all sorts of syntaxes, but I always get one of two sets of error messages from the compiler. If I use catch(Stack::Overflow): ch18pr01.cpp(89) : error C2955: 'Stack' : use of class template requires template argument list ch18pr01.cpp(13) : see declaration of 'Stack' ch18pr01.cpp(89) : error C2955: 'Stack' : use of class template requires template argument list ch18pr01.cpp(13) : see declaration of 'Stack' ch18pr01.cpp(89) : error C2316: 'Stack::Overflow' : cannot be caught as the destructor and/or copy constructor are inaccessible EDIT: I meant If I use catch(Stack<double>::Overflow) or any variety thereof: ch18pr01.cpp(89) : error C2061: syntax error : identifier 'Stack' ch18pr01.cpp(89) : error C2310: catch handlers must specify one type ch18pr01.cpp(95) : error C2317: 'try' block starting on line '75' has no catch handlers I simply can not figure this out. Does anyone have any idea?

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >