Thread: STL link issue.

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    97

    STL link issue.

    For some reason my code compiles successfuly but it doesn't link. Here is the code:

    Code:
    #ifndef __ENGINE_H__
    #define __ENGINE_H__
    
    #include <windows.h>
    #include <io.h>
    #include <fcntl.h>
    #include <gl/glew.h>
    #include <gl/wglew.h>
    
    #include <map>
    #include <string>
    #include <vector>
    #include <stdio.h>
    #include <stdarg.h>
    #include <stdlib.h>
    
    using namespace std;
    
    class VideoEngine
    {
    public:
    
    	static int init();
    	static void clear();
    
    	static void addPath(const char *path);
    
    	// paths
    	static vector<char*> path;
    };
    
    #endif //__ENGINE_H__
    Code:
    #include "Engine.h"
    
    void Engine::addPath(const char *path)
    {
    	char *s = (char*)path;
    
    	while(1)
    	{
    		char *p = new char[strlen(s) + 1];
    		char *d = p;
    
    		while(*s != '\0' && *s != ',') 
    			*d++ = *s++;
    		*d = '\0';
    
    		Engine::path.push_back(p);
    
    		if(*s == '\0')
    			break;
    		else
    			s++;
    	}
    }
    Am I doing something wrong?

  2. #2
    Registered User
    Join Date
    Oct 2003
    Posts
    97
    I fixed my own problem. I had to add the following line to the Engine.cpp
    Code:
    vector<char*> Engine::path;
    What is the reason for that?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 07:26 PM
  2. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 03:49 AM
  3. Undefined Structure in Link List
    By _Cl0wn_ in forum C Programming
    Replies: 1
    Last Post: 03-22-2003, 05:57 PM
  4. STL for fun and profit
    By Aran in forum C++ Programming
    Replies: 22
    Last Post: 08-16-2002, 08:32 PM