c++ 1 unresolved external even though all functions are being used -


trying test out code see if 1 of constructors works i'm getting error saying have 1 unresolved external , unresolved external symbol_main referenced in function "int_cdecl invoke main (void)" (?invoke_main @@yahxz , have no idea why

//cstring.h

#ifndef cstring_h #define cstring_h using namespace std;  namespace w1 { class cstring { public:      char str[55];             cstring(char* mystr, int max); }; }  #endif 

//source.cpp

#include <iostream> #include "cstring.h"  using namespace std;  namespace w1 { int x;  cstring::cstring(char * mystr, int max) {      if (mystr == null)     {         str[0] = '\0';     }     (int = 0; < max; i++)     {         mystr[i] = str[i];         x = i;     }     str[max] = '\0';     cout << str; } } 

//main.cpp

#include <iostream> #include "cstring.h" using namespace std;  namespace w1 { int main() {      cstring y ("marco", 2); //in theory should print ma       return 0; } } 


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -