I am trying to convert a cpp file to a .cu file . However the compiler is reporting errors for all the typedefs and static functions in cpp. It also does not detect the scope resolution operators and report errors for them as well.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
CUDA makes some significant changes to the way preprocessor macros are expanded, as it runs the code through the preprocessor multiple times to expand the CUDA constructs and separate host and device code. This is likely to break large existing code bases.
My general strategy in this case (and even with newly written projects) has been to keep all the existing code in .cpp files and only move as little code into .cu files as possible. I just move the typedefs and defines that are needed in .cu files as well as .cpp files into separate headers, and write small wrapper functions around CUDA calls and kernel launches which I then call from the existing .cpp files.