- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was trying to create a DLL file that can be called by R. But got the following error msg:
Error 1 error LNK2019: unresolved external symbol _MAIN__ referenced in function _main libifcoremt.lib(for_main.obj)
Error 2 fatal error LNK1120: 1 unresolved externals Debug\\RobMNE.exe
Did I do anything wrong? Thanks.
The fortran code is quite simple:
subroutine compute_bj(x, y, w, b, lambda, sigma)
!dec$ attributes dllexport, decorate, alias : 'compute_bj' :: compute_bj
!dec$ attributes reference :: x, y, w, b, lambda, sigma
real, intent(in), dimension (:,:) :: x
real, intent(in), dimension (:) :: w, y
integer, dimension (:), allocatable :: ind, num, deno
real, intent(in) :: lambda, sigma
integer :: n, p, i, l
real, intent(inout), dimension (:) :: b
n = size(x, dim=1)
p = size(x, dim=2)
allocate(ind(p-1))
allocate(num(n))
allocate(deno(n))
do l = 1, p
ind = (/ 1:(l-1), (l+1):p /)
do i = 1, n
num(i) = w(i)*x(i,l)*(y(i)-dot_product(x(i,ind),b(ind)))
deno(i) = w(i)*x(i,l)**2
end do
b(l) = sum(num)/(2*lambda*sigma**2+sum(deno))
end do
deallocate(ind)
deallocate(num)
deallocate(deno)
end subroutine
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You did not include the /dll option when compiling from the command line, or if you were using Visual Studio, you created a Console project rather than a DLL Library project. Therefore, the compiler thought you were trying to build an EXE that has to have a main program.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You did not include the /dll option when compiling from the command line, or if you were using Visual Studio, you created a Console project rather than a DLL Library project. Therefore, the compiler thought you were trying to build an EXE that has to have a main program.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot Steve. Now the problem is solved!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page