Programming :: G++ Fails On Multiple Files If There's A Template Involved
Aug 12, 2010If I remove all the template stuff, it works.
whats going on here?
If I remove all the template stuff, it works.
whats going on here?
Code:
anisha@linux-uitj:~/junk> ls -R
.:
include src
./include:
template0.h template0.h~ template0.h.gch
[code]....
I'm trying to do some network bonding in RHEL 5.4, and I'm not seeing the results I expect. I have set up a number of servers using mode 1 with no issue, but I need to configure a new server differently. bond1 is created from eth1 & eth2 bonded together using mode 802.3ad with layer2 lacp bond0 is created from bond1 & eth3 using mode active-backup with bond1 as the primary interface When I bring the network services up, all traffic is passing over eth3 instead of bond1, which is the primary. Below are the modprobe.conf * ifcfg-* files involved.
My modprobe.conf:
alias eth0 e1000
alias eth1 e1000
alias eth2 e1000
alias eth3 e1000
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptsas
alias scsi_hostadapter2 qla2xxx
[Code].....
I am having trouble understanding some concepts regarding C++ template specialization and I was hopping you guys can help me like you did last time.I will go right into the code and let the code do the talking.File foo.hpp
Code:
// Template Class
template < typename T1, typename T2> struct foo {
[code]....
I have two functions:
Quote:
void func1(std::string &s)
{
s.clear();
}
[code]....
Is there a way to create one template function for both vector and string that would clear them?
I use a mencoder line to convert .avi to .mpg (dvd player compatible), it works well but i can only do one file at the time. It requires giving the input and output directories and the files name. I tried using (*.avi *.mpg in the command) on the directory but it just add up all the .avi and convert them into one huge .mpg. My goal is to have a script that would convert all the .avi files from a directory to the same amount of .mpg and also keep the naming of those files. Here is what i work with on single files:
Code:
mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup
-srate 48000 -af lavcresample=48000
-lavcopts
[code]....
I feel kind of embarrassed posting here, but this is technically a scripting sub-forum. Here is the problem. I have a folder with various files which include .txt files as well
How can i redirect same content to each of the .txt files in the folder?
I have tried
Code: $ echo "hello" > *.txt
-bash: !": event not found Code: also cat ~/otherdir/test.txt > *.txt
-bash: *.txt: ambiguous redirect Can anyone help me with this?Ok i solved it
Code: #! /bin/bash
for file in *.txt
do
echo "Text that needs to be written" > $file
done
I want grep multiple files:
let abc.1.abc.2,abc.3,abc.4
I use grep <pattern> abc.* to read the files. But here grep read files in the order of 1,2,3,4 . I want to to grep the files in reverse order like 1st the abc.4 file will be read and abc.1 file will be last.
Is this possible ?
how i could compile for example: a tutorial file of cantera open source files. when i do :g++ example.cpp -o examplei get huge errors such as the header files are not here,...please tell me how i could compile it. ofcourse i have configured the full opensources and i see in /usr/local/cantera/binthat the files are there but i still can not compile and execute any cpp file.
View 2 Replies View RelatedI have a string problem with a function I am writing and I cant figure it out. I am trying to write unit test which will verify it works as expected. As I need to make use of it elsewhere and obviously robust and correct enough that I can rely on it. Okay first of all I define the following structure
Code:
typedef struct strarray {
int size;
char **elements;
} strarray;
code....
My problem is that upon the 4th iteration in the loop realloc fails in strarray_add. glibc reports invalid next size.
i have trouble to define a static member in a template, and i search from google, but didn't find any similar case, my case is a little complex, i paste the code below.code in xxx.h
Code:
template <class T> class FreeListManager
{
[code]...
I had some trouble doing this but finally figured it out. Here is a general solution:
Code:
#include <iostream>
using namespace std;
[code]....
Right now we send notification emails using a velocity template (apache and java), the thing is that the notification engine call the Email.vm file to add all the information and variables. This process only attach the information (text) on the .vm file.
We need to send that email on html. The thing is that if we write the html code on the file, when the .vm file is called that email includes the code not the result of the html.
We have tried adding the headers and everything.
The question is:
Is there some way that we can pre-process the html code and include to that email the result?
Or can we tell the .vm file that it should be handle as html? (like php for example <?php ?>, the <html> and </html> tags doesn't work.
this should have been a simple task, but for some reason one of my rollovers plain old isn't workingmy html sheet
Code:
<div style="background:#F5F5E9 url('/sites/all/themes/flossmoore1/images/bricks250.png');padding:1px;padding-
[code]....
I am new to the whole concept of makefiles, and I'm trying to compile and build my program using a makefile template I have found. My project consists of three directories: "source", where my .cpp files are (source1.cpp, source2.cpp, source3.cpp), "include", where my .h files are (header1.h, header2.h, header3.h), and "obj", where the object files are to be stored (obj1.o, obj2.o, obj3.o). In the project root directory is my makefile, which is as follows:
Code:
EXEC = myexe
CC = g++
IDIR = include
SDIR = source
ODIR = obj
[Code]..
My query is i have a.sql , b.sql , c.sql files which needs to be executed using "$ db2 -tvf a.sql"; "$ db2 -tvf b.sql"; "$db2 -tvf c.sql" , script with which i can execute all these sql files in a single shot.
View 4 Replies View RelatedI have a folder which includes bunch of folders each having data files in them. [ Folder A has F1, F2 F3 ..... F1000 folders in it, and F1, F2, F3 ... each has about 10 different files named FILE 1, FILE2, FILE3 .... in them.
I am interested in File 1 of each Folder, because that contains the data I need in it. More specifically, that File1 s have a line "ANSWER=..." in them, and i need to get that value of the ANSWER from each file. So doing it by hand is so hard, so I need to write a script that will scan all folders and give me a list of values of eache ANSWERs.
I am looking for the quickest way to do multiple searches for different files.Here is the scenario: I want to search for various icons one by one in a script. Preference is for the gnome icon theme.
The echo piped into grep part seems to take a long time. Is there a quicker way of doing this?I do not want to use slocate, sqlite or the like since that will require admin privileges to update the database and/or extra dependencies.
I have written FORTRAN code to calculate density profile. This code will open two files ( topology and x,y,z trajectory). The trajectory file contains XYZ data coordinates for multiple frames (about 20 or 100 frames for instance). One frame contains 20736 data.
Previously this code was written to open ONLY one input XYZ data file and do the calculation and would dump the results in separate file and it was running without problem. Recently my data file get bigger in size, so I decided to break the single XYZ data file into few small parts.
Now I have modified the code so that it calls the parts of the XYZ data files ( eg: maltoTHERMO_10Frames.traj, maltoTHERMO_20Frames.traj,... and so on) and do the calculation and dump the results in the same result output file. I have tested this code just with openning the XYZ coordinates and printing into another file to see wheather it collecting the data sequently and it was working fine.
This code supposedly read the x coordinate data and calculate distance and put a count accoding the criteria in the approperiate bins. But when I let the code to do the calculation it stop and shows error. (I have indicated as !** in the code). If I enable this line, it shows error but if I disable this line, than the code do collect only the XYZ coordinates.
The code is as below:
Code:
module all_parameter
integer,parameter :: MAXATOM=20736!CHANGE
integer,parameter :: midwater=1500
integer,parameter :: TOTALFRAMES=20
[Code]....
compiling and linking using gcc: What does a file name with a suffix '.a' represent? If I have multiple .c and .h files, how can I link them together? How can I create the .a file?
View 6 Replies View RelatedI am working with DM355 target board. Here we record. The video coming from IP cameras. Now I have to write c program for copying. The recorded avi files with date and time to NAS server using scp. I wrote a script to copy single file to NAS server.
#!/bin/bash
DATE=$(date +%Y%m%d_%H_%M_%S)
mv Camera1.avi Camera1_$DATE.avi
scp Camera1_$DATE.avi root@192.168.1.4:/root/test/
mv Camera1_$DATE.avi Camera1.av
But I have to write c program for copying multiple avi files with Date and Time to NAS server.
I want to change some HTML in my files (80+ so I prefer not to do this by hand). I got a script to replace a string in files, however the HTML I want to replace contains an enter (and tab of 4 spaces) (explanation below) Does someone know how I could update my HTML by using a function in Linux?
I also found sed but don't know how to use it with the enter (linenumbers will not work because they variate)...
[Code].....
I'm trying to change a group of cpp files to one shared lib. I have created a shared lib with a single file. I then did this with a group of files. The difference in what I'm doing is that before with the single file, .a, was added into a single .o file. Now I'm trying to add it to my main.cpp file which is NOT a .o file. I'm now getting these compiler errors from the main.cpp where is doesn't seem to recognize the semaphores.Example Error: undefined reference to `sem_wait'If I were not to use the share libs this compiles and runs as I expected it to.Something tells me this is a compiler flag issue, at least I hope it is
View 1 Replies View RelatedI've been hitting my head against a wall for awhile with this one:As the last part of some data analysis I performing I would to construct a matrix from a series of different files. These files have the format:
file 1 file 2 file 3
AAAAA .1 AAAAA .1 BBBBB .1
BBBBB .2 BBBBB .1 CCCCC .9
[code]...
I have wrote a 1 line command that parses a file, locates the IP Address in the file and then trims the output the way I want it, and then sorts numerically and by uniqueness and then >> appends to output.txt
I can get all the IP's into 1 file "output.txt", but what I am really looking for is some type of way to create a text file, for each IP it finds labeled xxx.xxx.xxx.xxx.txt and also put that ip address into that file..
xxx.xxx.xxx.xxx = the ip address it finds
I've been trying to sort this out for several hours and I?m totally lost? I?ve been searching around, but haven?t found the solution to my problem. I have a directory with 100 files. I need to copy 10 lines of each files (let?s say from line 45 to 55) into one unique file. So I guess I could use sed ?w, but I didn?t manage to write the right script. I also tried using a loop to create 100 different files, each one with the 10 lines) to concatenate them later on. But I only got 1 file, not 100.
View 12 Replies View Relatedbash script to give sensible names to a large number of photos. I hope to be able to run a script with an argument which will become the filename followed by a number beginning at 1.
Code:
./file_rename.sh Summer2009_
Summer2009_0001
Summer2009_0002
Summer2009_0003
[Code]....
I'm playing around with a bash script to pass files to a program (such as VLC). I thought something like this would work:
vlc $( ls | sed 's/ /\ /g' | tr '
' ' ' )
ls shows the files in the current directory, then sed changes spaces to " " (to escape them) and finally tr removes the line breaks. I end up changing:
01 - Music Track.mp3
02 - Another Track.mp3
to
01 - Music Track.mp3 02 - Another Track.mp3
"vlc 01 - Music Track.mp3 02 - Another Track.mp3" works if I type it manually but my script reports a problem with `-'
It seems it's not escaping the spaces.
I'm trying to develop an html template parser employing Flex & Bison, but now I found a problem and I don't know if surrender, so let's see if you can guide me to the solution (if any).
[Code]...
(Here I simplified the code to make only print what it gets, but it returns a token and the text to the bison program). Now my problem is that I would like to get the unknown characters as an unique string. [using the flex file above, returns char by char all HTML code that is not a comment!].
So, Could it be possible to make a flex rule that gets the HTML code?. It is not necessary to check if HTML code is correct I do it (before parse) using expat. Also there is no need to check the resulted code it will be done by the parser or compiler of the used language.
I know that are a lot of tools that uses this kind of templates in all languages and systems... but I'm just exercising my pour flex&bison skills. Also, using my current flex file, I have to remove the string "<!--MARKUP" from the beginning and "-->" from the end of returned string to bison... But in reality, if I could manage the HTML code as a flex rule, I could solve that sednding to bison an start Token, the code and and end token.
I have a template similar to the following.
Code:
template <charT>
virtual void do_get_date(charT* = "str")
{ ... }
As you can see we have a problem. If we use a wchar_t instead the string wont be formatted right we need to prefix L in front. If we use char16_t we need to prefix a u in front. Is there a was to make the generic without resorting the the std::string class?