- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a workable fortran project. Now I want to mix it with existing cc++ code (it is function,not lib). So, can anybody tell me what is the procedure.
Thanks,
Eric
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Assuming you mean you just want to add the c/c++files to the project then :
If you are using Visual Studio6 then the c/c++ files can be added to the existing project without problem.
Under Visual Studio .NET there will be a Fortran project under the solution and you will need to add a _new_ project to the solutionfor the c/c++ code.
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1) I generated new fortran project "test"-- console application--main program sample code
//// test.f90
program test
implicit none
! Variables
call helloworld(); ! call c function here
! Body of test
end program test
2) I added new c project (ctest3) into solution ---empty win32 console project
3) added hellow.cpp into c project
3) added hellow.cpp into c project
/////hellow.cpp
#include
extern "C" void helloworld();
#include
extern "C" void helloworld();
void helloworld()
{
printf("hello world ");
{
printf("hello world ");
}
4)------ Rebuild All started: Project: ctest3, Configuration: Debug Win32 ------
Deleting intermediate files and output files for project 'ctest3', configuration 'Debug|Win32'.
Compiling...
hellow.cpp
Linking...
LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
Debug/ctest3.exe : fatal error LNK1120: 1 unresolved externals
Compiling...
hellow.cpp
Linking...
LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
Debug/ctest3.exe : fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://c:Documents and SettingsEricMy Documentsctest3DebugBuildLog.htm"
ctest3 - 2 error(s), 0 warning(s)
ctest3 - 2 error(s), 0 warning(s)
---------------------- Done ----------------------
Rebuild All: 0 succeeded, 2 failed, 0 skipped
Did I do something wrong?
Eric

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