C++ :: How To Get Standalone Copy Of Regex Part Of Boost Library To Work In Project
Feb 18, 2012
So, I have spent the last week looking googling and researching how to get a standalone copy of the regex part of the boost library to work in a project. This project will be compiled on other machines and I CANNOT have the user install it.
Is there any way to do this?
So far, I have built the regex part: I have both .so files and .a files built. The thing that I'm unsure of is that these were built with gcc and I am using/will be using g++.
I have also finally got the bcp tool to work, and extracted the regex part and all of its dependencies.
I can't get it to compile any way I try to work it. I need this to be in a folder "regex/" folder in my directory.
I have used too many commands to paste them all, but the last I tried was this:
I have also tried many variations of the above command. Such as using -lboost_regex and lots of other things. Is my whole problem because I'm using an .so built by GCC?
The output of the above command was
/usr/lib/gcc/i686-linux-gnu/4.6.1/libstdc++.a(eh_alloc.o): In function `__cxa_allocate_exception':
(.text.__cxa_allocate_exception+0xb4): undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/i686-linux-gnu/4.6.1/libstdc++.a(eh_alloc.o): In function `__cxa_allocate_exception':
(.text.__cxa_allocate_exception+0x111): undefined reference to `pthread_mutex_unlock'
/usr/lib/gcc/i686-linux-gnu/4.6.1/libstdc++.a(eh_alloc.o): In function `__cxa_free_exception':
So I need to use boost/regex for regular expressions. someone told me that it needs to be built. the first problem is boost doesn't tell you how to build it and the second is i did sudo apt-get install libboost something. I don't remember the exact name of the package. it installed but i dont know how i would build it when its installed.
I want to use C++ regex library, to use it in my lil' CLI game. The aim is to create the template(not C++ template :)) for command(like "go north"). Then, if player writes anything that contains "go", and "north" appearing after that(examples: "go north" "please go north" "Let's go north!" "Princess, I insist that we go to the north") would all be interpreted as simple "go north". I have used a bit of regex in Linux system, but not this ECMAScript regex that C++ uses.I've checked in some online regex tester, that if I write: ".*go.*north.*" then anything I want will be matched; however, I'd like these to be specifically separated by space(the rule is: between north and go there must be at least one character: a space, so that gornorth won't be interpreted as command.).
Bonus points: if it's possible to do that without some kind of black magic, I'd like to achieve following goals:
1)Before go, there can be any amount of characters, but if there is 1 or more characters, the character just before go must be space. 2)In between go and north, there must be at least one character, space. If there are more, then characters right after go and just before north have to be spaces.
I'm trying to serialize a struct which contains two or more other types of sturct. But it seems that serialization does not work. Below is sampel code :
class Base { char * ptr; public: Base(){} Base(char * str)
[code].....
Obj1 is a derived class object where base class char pointer is initialized with "singh" and derived class char pointer is initilized with "sunil". I want to create Obj2 out of Obj1. Separate memory should be created for Obj2 char pointer (base part and derived part as well) and that should be initialized with the strings contained in Obj1.
Here the problem is: Derived class part can be initialized with copy constructor. How to initialize the base class char poniter of Obj2 with the base class part of Obj1. char pointers in both the classes are private.
I tried using initializer list but could not succeed.
I have written a program that uses boost in visual studio 2012. The only boost library I used is filesystem by doing.
1)Properties->Linker->General and adding the path or the .lib to the additional dependencies. The libraries, link at compile time.However when i move the exe to a different computer, it doesn't work. Therefore the libraries were dynamically not statically linked. So my question is how do I statically link the filesystem library, so that i can include boost/filesystem.hpp in visual studio 2012?
I have a text file which consists of 907 objects and 1000 feature vector for each object. Is there any Library (Eigen/Boost) to calculate Principle Component Analysis(PCA)?
I'm trying to write a program that uses the Boost library to input a string date in the format mm/dd/year and outputs to the string its corresponding day of the week. I wrote the program that I thought would accomplish this, but it doesn't seem to work. Below is the code I wrote:
When I compile this using codeblocks it gives me the error "In function `ZN5boost9date_time19month_str_to_ushortINS_9gregorian10greg_monthEEEtRKSs':| C:Users osaDesktop est3........Liboost_1_55_0oostdate_timedate_parsing.hpp|67|undefined reference to `boost::gregorian::greg_month::get_month_map_ptr()'". And it takes me to the file date_parsing.hpp and highlights line 67. I don't understand why this isn't working.
I should reduce the number of bitmaps I used in my code. I translated my particle engine into code that could be compiled as plain standard C
Currently, the code has a segmentation fault somewhere that I can't figure out. How it should function is that it takes orders from a queue for new lasers to store the instances in a linked list. It then takes that data and updates its coordinates, one node at a time. The first node should also be the first node to complete its life, so it gets removed, and the list is set to the next node in memory. If there are no more nodes left, a if-statement should catch it and either break the current loop, or wait for more items to be requested. If there are nodes left, the process will continue to remove the first node in the list until there are none left. Obviously this is not quite how it works. When I tested in once in SDL, the laser would update every 5 frames, but wasn't shown constantly, and would crash after the node was to be disposed of. When I initialize with the SDL parachute, it would exit before I event saw the screen. Also, the code I translated to standard C will display that the laser has been updated to the screen, but it never says that it has moved up. It crashes after about 4 printf() statments execute. My debugger has been giving me mixed SIGTRAPS, and "nothing is wrong" output. Here is the code in standard C:
I have a WPF DataGrid with DataGridTemplateColumns, when I select rows and use Ctrl+C, and then in Excel or any document Ctrl+V, no data is pasted. If I change columns to DataGridTextColumn then copy and paste works fine. What can I do to make work copy & paste with DataGridTemplateColumn? Also when I set ClipboardContentBinding="{Binding FirstName}" for the template column, Null Refrence exception is thrown.
i'm right now using C, IO is done via ncurses, but that won't affect the following problem, i think. The relevant code is:
#define SIDEBARWIDTH 27 //... typedef struct {
[Code]...
surprisingly this works, now the new 3rd outputline is correct again. So it seems that the printcommand has some troubles with accessing the struct here. Not sure if that might be ncurses fault. Still feels odd.
I am trying to add in a few 3rd party libraries to an existing project solution. I have no source code or knowledge on how the libraries were built (i.e. what run-time library was used). I have recieved the following errors and warnings:
1>CAPS_LIB.lib(PCEfunc.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance 1>libcmt.lib(getenv.obj) : error LNK2005: _getenv_s already defined in MSVCRT.lib(MSVCR90.dll) ***There are multiple of these errors 1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library 1>MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library 1>libcmt.lib(crt0.obj) : error LNK2001: unresolved external symbol _main 1>C:Program Files (x86)BCI 2000 v3progRelWithDebInfo..CAPSVRInterface.exe : fatal error LNK1120: 1 unresolved externals
CAPS_LIB.lib is one of the libraries I am trying to add in and it seems to be the one causing the problem. I believe I have added in all three libraries into the project solution correctly, but I can't seem to find a solution to these errors.
std::vector<unsigned char> vec1; //insert some values into vec1 std::vector<unsigned char> vec2;
Now I want to to copy 2 bytes from vec1 starting at index 5., why do i need to know how many bytes from the end of vec1?? can't i just specify how many bytes i want to copy from starting index?
I need to write a standalone sort function, which will take a linked list parameter and sorts it. The function is included in the main list class as friend class: Code: friend void sort (UList<T>&) I need to submit separate SortIS.h file for insertion sort. Here is my code:
Code:
#include <iostream> template <class T> void SortIS(UList<T>& list) { T temp; for (int i=1; i<list.size(); i++) { temp = list[i];
[Code]...
But the teacher said it didn't compile returning an error: "undefined reference to `void". What I am missing here?
I have a project which does a specific thing, like an open file dialog.
I would like to open it in a different project on a click of a button.
Also, It has a different namespace.
I'm guessing that it would involve a "using" statement to add the namespace And I will have to add reference to an *.exe or *.dll -> I'll have to look up how to make a *.dll, I know where the *.exe file is.
I have searched for a different things on Google, but I don't think that I am looking for the correct phrase (which is always frustrating...)
I've been reading about libraries; How to make them, how to use them, the different types of libraries, etc..
When using a shared library, does the program require that library to be installed on the computer after the program has been compiled into an .exe?
Ie.. if somebody downloaded a "Helloworld.exe" that I had compiled on my computer using a shared library (that wasn't part of a standard operating system), would they also need that shared library on their computer for the program to run without errors?
and for Static Libraries, when I compile a program using a static library, does it include in the final binary only the functions of the library that are actually used, or does the compiler add in the entire library?
I have a multimap with over 300k entries defined like so: std::multimap<std::string, std::string> filedata;
Using the following code and std::multimap::equal_range, I am able to successfully search for a word in the multimap and get needed data:
// Data with strings. data = std::vector<std::string>(); // Get iterators to matched pairs. std::pair <std::multimap<std::string, std::string>::iterator, std::multimap<std::string, std::string>::iterator> dat = filedata.equal_range(word); // Go through each matched pair and get needed info. for (std::multimap<std::string, std::string>::iterator iter = dat.first; iter != dat.second; iter++) { data.push_back(iter->second); }
Now, I would like to search the multimap using regular expressions (EX: std::regex("[a-z][a-e]h")). What is the fastest way to do this? Example code may look like:
std::pair <std::multimap<std::string, std::string>::iterator, std::multimap<std::string, std::string>::iterator> dat = filedata.equal_range_with_regex(std::regex("" + word + ""));. Pseudo-code / algorithms will be enough.
no instance of overloaded function "std::vector<_Ty, _Alloc>::push_back [with _Ty=std::pair<std::regex, std::string>, _Alloc=std::allocator<std::pair<std::regex, std::string>>]" matches the argument list argument types are: (std::pair<const char *, const char *>) object type is: std::vector<std::pair<std::regex, std::string>, std::allocator<std::pair<std::regex, std::string>>>
and get an Iterator to the beginning of the match by
matches->at(i)->begin()
How can I get the relative position of the match within the entire target string (i.e. "Unseen University", where, in this case, the positions should be 0 and 7)??
I am using the (fairly) new STL implementation, which I just became aware of, of regexes. Seems to be an implementation of boost::regex Anyway, I have code, which I would like to use to get ALL matches within a string.
The problem, is that I dont know how to make Regex get Integers no matter what (e.g. even if an =, >,<,>=,<= sign is in front or anything) unless it is encased in a string e.g. "'s or whatever.
My current code does this:
I do not want the numbers to be highlighted if they are in a string.