Use variable from function in one cpp file in another cpp file c++ -
i'm sending variable function 1 cpp file using header file , extern. issue files not filled when arrive second cpp file.
//tmp.h //declare tmp_user , tmp_pass extern ustring tmp_user; extern ustring tmp_pass; //tmpone.cpp //define tmp_user , tmp_pass #include "tmp.h" ustring tmp_user; //define outside of function ustring tmp_pass; function(blah, blah){ tmp_user = username; //fill variable within function tmp_pass = password; //more code } //tmptwo.cpp //use defined variables #include "tmp.h" login(tmp_user, tmp_pass) //both of defined variables empty. { //some function }
my issue both of variables empty when called in second cpp file. i'm using visual studio 2010 , both of cpp files in same project.
Comments
Post a Comment