Intel® oneAPI Base Toolkit
Support for core tools and libraries to build and deploy high-performance data-centric applications

DPCPP Compilation Error

_Santosh_
Beginner
935 Views

Hi ,

I have migrated single cuda file and getting the below error while compilation:

 

$ dpcpp sample.dp.cpp

/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crt1.o: In function `_start':

(.text+0x20): undefined reference to `main'

clang++: error: linker command failed with exit code 1 (use -v to see invocation)

 

Can you please help to make compilation successfull?

 

0 Kudos
1 Solution
GouthamK_Intel
Moderator
900 Views

Hi Santosh,

Thanks for providing the details.


We have observed that the source code which you have provided doesn't contain "main", hence you are getting "undefined reference to `main'" error.


Or, If you wanted to generate only an object file and link it later, you can use -c flag.

Ex:

dpcpp -c sample.dp.cpp


Please let us know if this helps you.

If you face any further challenges please do let us know.


Have a Good day!


Thanks & Regards

Goutham


View solution in original post

6 Replies
GouthamK_Intel
Moderator
917 Views

Hi Santosh,

Could you please share the sample source code which you are trying to migrate? (ex: sample.cu)

Also, let us know the below environmental details.

OS Version:

Intel oneAPI Base toolkit version:


Thanks & Regards

Goutham


_Santosh_
Beginner
913 Views

Hi,


Please find the details below.

OS Version: Ubuntu 18.04

Intel oneAPI Base toolkit version: Intel One API beta 9.0

Also find the attached sample.cu file in .txt fomat.

 

GouthamK_Intel
Moderator
901 Views

Hi Santosh,

Thanks for providing the details.


We have observed that the source code which you have provided doesn't contain "main", hence you are getting "undefined reference to `main'" error.


Or, If you wanted to generate only an object file and link it later, you can use -c flag.

Ex:

dpcpp -c sample.dp.cpp


Please let us know if this helps you.

If you face any further challenges please do let us know.


Have a Good day!


Thanks & Regards

Goutham


GouthamK_Intel
Moderator
864 Views

Hi Santosh,

Could you please confirm if your issue is resolved?

If yes, let us know if we can close this thread from our side.


Thanks & Regards

Goutham


_Santosh_
Beginner
854 Views

Hi  Goutham,


Thank you for the response, My issue has been resolved!

 

Thanks & Regards,

Santosh

GouthamK_Intel
Moderator
841 Views

Hi Santosh,

Thanks for the confirmation!

As this issue has been resolved, we will no longer respond to this thread. 

If you require any additional assistance from Intel, please start a new thread. 

Any further interaction in this thread will be considered community only. 


Have a Good day!


Thanks & Regards

Goutham


Reply