Code compile success in Windows, but not Linux???

Does not make sense to me, but here is a sample code I tried:

http://codepad.org/LRcFgnZN

The errors I get…

make all
Building file: …/main.cpp
Invoking: NVCC Compiler
nvcc -G -g -O0 -gencode arch=compute_11,code=sm_11 -odir “” -M -o “main.d” “…/main.cpp”
nvcc -G -g -O0 --compile -x c++ -o “main.o” “…/main.cpp”
…/main.cpp: In function int main():
…/main.cpp:74:10: error: expected primary-expression before < token
…/main.cpp:74:19: error: expected primary-expression before > token
…/main.cpp:76:71: warning: comparison between enum cudaMemcpyKind and enum cudaError [-Wenum-compare]
…/main.cpp:76:82: error: cannot convert bool to cudaMemcpyKind for argument 4 to cudaError_t cudaMemcpy(void*, const void*, size_t, cudaMemcpyKind)
…/main.cpp:77:3: error: expected ) before { token
…/main.cpp:103:11: error: name lookup of i changed for ISO for scoping [-fpermissive]
…/main.cpp:103:11: note: (if you use -fpermissive G++ will accept your code)
…/main.cpp:103:19: error: expected ; before ) token
…/main.cpp: In function void AddInts(int*, int*, int):
…/main.cpp:124:11: error: blockIdx was not declared in this scope
…/main.cpp:124:24: error: blockDim was not declared in this scope
…/main.cpp:124:36: error: threadIdx was not declared in this scope
make: *** [main.o] Error 1

**** Build Finished ****

Line numbers here and in the paste link are the same.

I have no idea why the code would not be portable between the two.

Thank you.

rename main.cpp to main.cu, otherwise the source code is treated as ordinary c++ but not CUDA c.