Intel® oneAPI Base Toolkit
Support for the core tools and libraries within the base toolkit that are used to build and deploy high-performance data-centric applications.

DPCPP Compilation Error

_Santosh_
Beginner
1,782 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
1,747 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

0 Kudos
6 Replies
GouthamK_Intel
Moderator
1,764 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


0 Kudos
_Santosh_
Beginner
1,760 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.

 

0 Kudos
GouthamK_Intel
Moderator
1,748 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


0 Kudos
GouthamK_Intel
Moderator
1,711 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


0 Kudos
_Santosh_
Beginner
1,701 Views

Hi  Goutham,


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

 

Thanks & Regards,

Santosh

0 Kudos
GouthamK_Intel
Moderator
1,688 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


0 Kudos
Reply