I am creating multiple C++ DLLs which have a C wrapper around them for use by an external application. I wanted to have a single error handling library that each DLL has access to. If I created the error library as a static library and then include it in the DLLs I get an issue saying that the library header file could not be found when testing it in a dummy c++ app by including the wrapper header. If I call the DLL in a C or C# app then it works fine. Is this just down to how the …

Member Avatar
+0 forum 0

There is a problem with static variables and functions in how it is used by apps and frameworks in PHP , they are used as global functions or parameters while this is by far what they mean. It is easy to write the same functional or even procedural code in PHP using static variables dressed up as OOP. I have nothing against functional programming or even procedural (my work for some years was turning Cobol into Java , and I have seen real diamonds in the way they done it (along of course of rubbish) ) . There is no …

Member Avatar
Member Avatar
+0 forum 10

# Introduction # A recurring problem many newcomers face when tackling C++ is the compilation process, from sources to binaries. This tutorial will detail that process. It will be especially useful for people only familiar with higher-level languages (if any), but veterans of one or more native languages (C, Fortran, C++, D, etc.) might still learn a thing or two. And to that point, I would also mention that conceptually, most of this tutorial applies to any native, compiled language. For widest applicability, this tutorial will feature GNU tools (GCC) used in a Unix-like environment (POSIX). For Mac OSX, the …

Member Avatar
Member Avatar
+11 forum 2

I know this has been asked before, but I can't find any simple answers for a noob like me in C#. What exactly is a static method. I mean what does it mean to be static vs. nonstatic. I know in the code with the main method we use `public static void Main(string []args)` what does the static change about the main method that distinguishes it from the rest in regards to it being static. - Thanks

Member Avatar
Member Avatar
+1 forum 11

Hello All. Been playing around with some linked dropdowns. It seems to be a recurring theme here on DW, so I thought I'd offer this up as a possible solution or for discussion, to see how it could be improved. The premise for this set of linked dropdowns is that it is not dependent on php or Ajax following page load, that is to say, all the data is initially dumped into json format from the database and then everything is left to javascript. I've used jQuery to produce a plugin, but the same functionality is possible with just plain …

Member Avatar
Member Avatar
+5 forum 3

Hi guys, I wrote the following code: public static boolean match(int[] a , int[] pattern) { //need to use the overloaded method, in order to work with the static method. return match(a,pattern,0,0); } /** This is an overloaded method that match between a pattern to a given string (as an array)*/ private boolean match(int[] a, int[] pattern, i, j ) { if(j==pattern.length) return true; if( (i==a.length) && (j!=pattern.length) ) return false; switch(pattern[j]){ case 1: if( (a[i]/10)==0 ) return match(a, pattern, i+1, j+1); return match(a, pattern, i+1, j); break; case 2: if( ( (a[i]/10)==0 ) && ( (a[i]/100)==0) ) return match(a, …

Member Avatar
Member Avatar
+0 forum 33

My header file header.h #ifndef HEADER_TEST #define HEADER_TEST static test_variable; #endif now i am including this in two source files IN THE SAME PROJECT. multiple definition error. i have used static specifier in header file . please help me understand this.i think static makes internal linkage. regards, ravi

Member Avatar
Member Avatar
+0 forum 1

hi i can't undestanding this why the main function in java is static and static function can call using class name. And why we declare main function as public. i can not understanding this procedure of main function in java. plz help me.

Member Avatar
Member Avatar
+0 forum 1

Hi, all. I'm have a class EnemyController with a function Spawn(...) that instantiates a new object of the appropriate type. I want to call Spawn from somewhere like my TileMap class to create a new Enemy in my tile collision method. Here's what I have so far... class EnemyController { public: EnemyController() {} ~EnemyController() {} static void Spawn( int x, int y, EnemyType type ); virtual void OnUpdate( Camera& cam ) { int index = 0; for( auto i= EnemyList.begin(), end = EnemyList.end(); i != end; i++ ) { EnemyList.at( index )->GetState().OnUpdate(); EnemyList.at( index++ )->Draw( cam ); } } public: …

Member Avatar
Member Avatar
+0 forum 1

my question is that when we use static data member and ststic function and nobody can not satisfy me about this question i need actual reason of using the static data member and ststic member function

Member Avatar
Member Avatar
+0 forum 6

Similarly, you can add more fields to an enum and simply provide accessor methods to retrieve them. For example you could change it to have an extra field indicating an output directory to write specific types of data to, and a getter method to return that directory.

Member Avatar
Member Avatar
+0 forum 2

Why isn't the Microsoft built in class Random class an type static class as the Math. class is. Why didn't they make this class static?

Member Avatar
Member Avatar
+0 forum 3

method non static public class LoGIne{ public String user (String a){ String rr = txt_user.getText(); String pass = txt_pass.getText(); //ConDb(user,pass); return rr; } --------------------------------------------------- method static public static Connection ConDb(){ //String USER ="mh"; String d ,l,h; d =("ameer"); String PASS=d; LoGIne a = new LoGIne(); String USER = a.user(h); // String PASS = "ameer"; try{ //STEP 2: Register JDBC driver Class.forName("oracle.jdbc.driver.OracleDriver"); Connection conn = DriverManager.getConnection(DB_URL,USER,PASS); return conn; }catch(Exception e){ JOptionPane.showMessageDialog(null, e); return null; } -------------------- we will return value of function user to use it in function conDB to give value into this **USER** = user(h); Connection conn = DriverManager.getConnection(DB_URL,**USER**,PASS);

Member Avatar
Member Avatar
+0 forum 10

I keep getting loads of linker errors that probably have something to do with virtual-functions/definitions and/or static class members... I've seen several relevant posts but none of the solutions suggested work, can you see wht the problem is here? My projects consists of 3 files: BALLS.H #include <iostream> using namespace std; class Ball{ //Abstract Class!! protected: //no Balls will be constructed int durability; bool hidden; public: Ball(int dur=0) :durability(dur), hidden(false){} virtual void hit(){} virtual void rest()=0; virtual int get_state() {} }; class Basket : public Ball { public: Basket(int L1) :Ball(L1) { cout<<"New basketball!"<<endl; count++; } void rest(){} int get_state(); …

Member Avatar
Member Avatar
+0 forum 3

i have some problem about link the library to executable. i tried to statically linking but when i create the .a file i always failed, what i want to know is there any way for the exe look up into current directory instead of the system if i has all the depedency. Hope someone has some experience on it, thanks for the attention

Member Avatar
Member Avatar
+0 forum 2

Hello, I noticed that in c++ everything that can be done using a static function in a class could be done by using a public function in the same namespace. Assuming that you bind your classes in a namespace these functions do not take up names in the global namespace. As such I was wondering when to use static functions in classes and when to use public functions. For an example here is the current situation where I cannot decide which to use: class Sprite {// private: //Some image data public: //some functions Sprite &applyPoints(vector<Coord2D> ps,Colour c);//applies the given colour …

Member Avatar
Member Avatar
+0 forum 3

Hey everyone, So I am having trouble getting my head wrapped around a php script I need to build. What I am trying to do is pull data from a MySQL database table (dynamic content) and match it to an html table with static content. I guess an example of this would be having a table setup to display like so: | Unique ID | Info | Etc |(static id)| (database searches for and populates this td based off of the static id) | (More dynamic content) Now kinda the basis of the code you'd use regularly to display all …

Member Avatar
Member Avatar
+0 forum 2

Hi, In Virtual Box I've installed Fedora 17 and setup LAMP development environment. I've set the static ip to access the localhost and the applicaions/projects. Now I would like to configure it as to access them using the static IP from the host machine (Windows 7 OS). How can I do this? Please elaborate. Thanks in advance.

Member Avatar
Member Avatar
+0 forum 2

currently I have a class function: class MyClass{ static int E(int A,int B, int C){ //function code } }; //and I call it like this : MyClass::E(1,2,3); //what I would like to do is call it in this way: E(1,2,3); //my current macro definition is this #define E(a,b,c) Myclass::E((a),(b),(c)) how do I correct my macro definition to generate the corect code?

Member Avatar
Member Avatar
+0 forum 1

this is my contacts class <?php class contacts { private $name; private $cno; private $clocation; public function __construct($name,$cno,$clocation) { $this->name = trim($name); $this->cno =trim($cno); $this->clocation=trim($clocation); } public function getName() { return $this->name; } public function getNO() { return $this->cno; } public function getLocation() { return $this->clocation; } } class DataBaseAction extends contacts { private $db_info; private $db_user; private $db_pass; private $db; private $stmt; public function __construct() { $this->db_info ='mysql:host=localhost;dbname=finalproject'; $this->db_user ='root'; $this->db_pass ='mrhot'; } public static function insert_contact($sql) { $this->db = new PDO($this->db_info, $this->db_user, $this->db_user); $this->stmt= $this->db->prepare($sql); $this->stmt =execute(array('$this->getName()','$this->getNO()','$this->clocation()')); $this->stmt =closeCursor(); } } and index.php fil e is <!DOCTYPE HTML> …

Member Avatar
Member Avatar
+0 forum 9

I was doing my assignment till I reached this point. Add a static Date toDate(String str) method to the DateTest class. If the method is called with a string like “23/5/2013”, it will create and return the corresponding date object. If the input string is not valid date, the method should return null. Hint: use the String.split(“/”) method to split the string in three parts and retrieve the day, month, and year. Or use the String.indexOf(“/”) and String.substring() methods to extract the three components of the date from the string. I am stuck in this step I don't know what …

Member Avatar
Member Avatar
+0 forum 7

The following code gave error on gcc compiler int main() { extern int a; printf("%d",a); return 0; } static int a=5; But when static is removed from int a then it runs with no errors..Can someone please clear the doubt??

Member Avatar
Member Avatar
+0 forum 10

So I have been working on this project for quite some time and I can't figure out why I keep getting an "Illegal Start of Expression" error. I tried moving the variables above the main method and that only returned the same error but instead of the error occuring at line 14, it occurs at the start of the next method(applet). Any help would be greatly appreciated! I'm sure it's just some stupid formatting error... package superhangman; import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.util.Random; public abstract class SuperHangman extends Applet implements ActionListener { public static void main(String[] args){ static …

Member Avatar
Member Avatar
+0 forum 2

I'm just learning html but already have a domain, so I did a quick and dirty under construction page to replace the advertising-littered default page that the webhost was using. It's dirt-simple and not very good, but I'll make it better as time goes on. Is there any rule I'm breaking with this page? It's at eyetee dot org. (And, yes, I have legal license to use the image for my personal website.)

Member Avatar
Member Avatar
+0 forum 3

Programe #1 inside file.h class File { public: static const int var = 9; }; inside main.cpp #include <iostream> #include "file.h" using namespace std; int main() { File f; cout << f.var; return 0; } Programe #2 inside file.h int Globalvar ; class File { public: static const int var = 9; }; inside main.cpp extern int GlobalVar; #include <iostream> #include "file.h" using namespace std; int main() { cout << GlobalVar; return 0 ; } Program#1 is running fine, but program#2 gives linker error: error LNK2005: "int GlobalVar" (?x@@3HA) already defined in file.obj I know the header files are never …

Member Avatar
Member Avatar
+0 forum 4

Here is the exercise: > fileWord > Write the definition of a function named fileWord that receives a string argument that is the name of a file containing words. > > The first time the function is called, it returns the first word of the file whose name it was passed. The second time the function is called, it returns the second, word of the file whose name it was passed (which could be a different file than was passed the first time). The third time, it returns the third word in the file whose name it was just passed, …

Member Avatar
Member Avatar
+0 forum 3

I need a way to do a cast without being returned a pointer to a new address but, the same address as the original. Something like this: derivedClass something_derived; baseClass* basePointer = &something_dervived; derivedClass* derivedPointer = static_cast <derivedClass*> (basePointer); /* my problem is "derivedPointer" isnt assigned the same address as "basePointer". I need a pointer back to type "derivedClass" to "basePointer"'s address */

Member Avatar
Member Avatar
+0 forum 7

matrix multiplication program

Member Avatar
Member Avatar
-1 forum 2

I need a help? I m designing a webpage. I have used <**div**>s everywhere, from header to footer, moreover I have used **relative** **positioning** with **top** and **right** tag. Somewhere top value has gone -1200 and so. At last I m left with about 800px of useless area below the footer and I don't want that. I looks very disgusting.Is there anyway of removing those ***whitespaces*** or stopping scroll below the ***footer*** block???? I there anyone for rescue?? **HELP** **HELP** **HELP**!!!!!!!!!!!!!!!

Member Avatar
Member Avatar
+0 forum 6

I use dr java for linux to run my code. I've been running into a bunch of errors recently while running this simple program. The code compiles fine but whenever I run the java file, I get the error; Static Error: Undefined name here's my code; (I've got two files, Square.java and SquareD.java) public class Square{ private String name; private int y; private int x; public Square(String st,int x2,int y2){ name=st; x=x2; y=y2;} public int square(){ return x*x+y*y;} double a1=(double) x; double a2=(double) y; public double hypotenuse(double a1,double a2){ double sum = a1*a1+a2*a2; return Math.sqrt(sum);} public int area(){ return x*y;} …

Member Avatar
Member Avatar
+0 forum 2

The End.