Skip to content

Instantly share code, notes, and snippets.

@blahgeek
Created February 28, 2017 02:43
Show Gist options
  • Save blahgeek/d6118aeb9c667a449ee1561cd3038a76 to your computer and use it in GitHub Desktop.
Save blahgeek/d6118aeb9c667a449ee1561cd3038a76 to your computer and use it in GitHub Desktop.
g++-5 lib.cpp -c -o lib.o -std=c++11
nvcc test.cu -ccbin /usr/bin/g++-5 -std=c++11 -c -o test.o
g++-5 lib.o test.o -L/opt/cuda/lib64 -lcudart
./a.out

Would not prints 1 as expected.

#include <glm/glm.hpp>
int g(glm::vec3 x) {
glm::vec3 xx = x + x;
return xx.y;
}
#include <iostream>
#include <glm/glm.hpp>
int f(glm::vec3 x) {
glm::vec3 xx = x + x;
return xx.x;
}
int main() {
glm::vec3 v(0.5f);
std::cout << f(v) << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment