Created
February 24, 2015 16:12
-
-
Save Ratstail91/754b249f89fb484194d0 to your computer and use it in GitHub Desktop.
Strangely, GCC 4.8.1 doesn't really handle namespaces properly?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "name.hpp" | |
namespace test { | |
void printVar() { | |
std::cout << var << std::endl; | |
} | |
void setVar(int i) { | |
var = i; | |
} | |
int getVar() { | |
return var; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "name.hpp" | |
int main(int, char**) { | |
test::printVar(); | |
test::setVar(50); | |
std::cout << test::getVar() << std::endl; | |
std::cout << test::var << std::endl; | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
namespace test { | |
namespace { | |
int var = 0; | |
} | |
void printVar(); | |
void setVar(int i); | |
int getVar(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 | |
50 | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment