Author Topic: Issues in importing a MS Visual C++ .NET 2003 solution  (Read 26564 times)

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #15 on: August 10, 2005, 09:17:32 pm »
Ok, I see. Thanks for the explanation. Personally, I have always installed MS Visual Studio .NET 2002 and later 2003, so I could not really notice it.

Anyway, let me congratulate again for the good job you are doing with CodeBlocks  :D and I hope that you will continue in the future. Until now it is the best alternative after MS Visual Studio .NET 2003.

Best wishes,
Michael

alixia

  • Guest
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #16 on: October 19, 2005, 06:31:36 pm »
I´m still having the problem:
error LNK2019: unresolved external symbol __ftol2

I´ve proved to put the next lines of code in my c file:

#if (_MSC_VER >= 1300) && (WINVER < 0x0500)
//VC7 or later, building with pre-VC7 runtime libraries
extern "C" long _ftol( double ); //defined by VC6 C libs
extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#endif

but now the problem is the string "C", it isn´t recognized by the compiler maybe. I´ve installed the microsotf c++ 2003 toolkit.
I don´t understand.

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #17 on: October 19, 2005, 07:26:04 pm »
I´m still having the problem:
error LNK2019: unresolved external symbol __ftol2

I´ve proved to put the next lines of code in my c file:

#if (_MSC_VER >= 1300) && (WINVER < 0x0500)
//VC7 or later, building with pre-VC7 runtime libraries
extern "C" long _ftol( double ); //defined by VC6 C libs
extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#endif

but now the problem is the string "C", it isn´t recognized by the compiler maybe. I´ve installed the microsotf c++ 2003 toolkit.
I don´t understand.

It should be, unless you're not compiling it as C++. (note: C doesn't support extern "<language>" declarations, that's a C++ addition)
If you're trying to compile it as both C and C++, try something this:
Code
#if (_MSC_VER >= 1300) && (WINVER < 0x0500)
#ifdef __cplusplus
extern "C" {
#endif
//VC7 or later, building with pre-VC7 runtime libraries
long _ftol( double ); //defined by VC6 C libs
long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#ifdef __cplusplus
} // extern "C"
#endif
#endif

or this:

Code
#ifdef __cplusplus
  #define EXTERN_C extern "C"
#else
  #define EXTERN_C
#endif // __cplusplus

#if (_MSC_VER >= 1300) && (WINVER < 0x0500)
//VC7 or later, building with pre-VC7 runtime libraries
EXTERN_C long _ftol( double ); //defined by VC6 C libs
EXTERN_C long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#endif

alixia

  • Guest
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #18 on: October 20, 2005, 09:23:49 am »
No, those possible solutions don´t work. The message is the next:

error LNK2001: unresolved external symbol __ftol@8
error LNK2001: unresolved external symbol __ftol2

I don´t know what to do because I need solve this problem to continue my program! :,(

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #19 on: October 20, 2005, 08:33:37 pm »
it seems you forgot to add a library to the link libraries list in your project. You need to find out which VC6 library has these contained in, and link it.

Code::Blocks does NOT add the libraries for you! You need to figure them out on your own.

alixia

  • Guest
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #20 on: October 21, 2005, 01:01:34 am »
I know a library is needed but what?
In my link tab I have a lot of libraries, but I don´t know what is the one I need exactly.
I´ve proved with libc.lib, libcd.lib, but the problem continues.
Somebody know what is?

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #21 on: October 21, 2005, 01:45:02 am »
Hmmmmmmmmm. Perhaps some of the options got lost... try converting your solution to a Visual C++ 6 workspace, and then import. Does it work?

alixia

  • Guest
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #22 on: October 21, 2005, 12:04:55 pm »
I comment my problem from the begining:

I have some .c, .h and .f (fortran) files. I need to create a dll with them. For it, I use the compaq visual fortran profeesional 6.5 because I have .f files (fortran). All the files compile perfectly. But the problem is linking.

I´ve downloaded the microsoft c++ toolkit for the compiler in c.

I don´t change to visual c++ 6 because it doesn´t compile fortran files, and I need them. I need to create a dll, and it is possible with compaq visual fortran.

The problem continues... :

CCFD.obj : error LNK2001: unresolved external symbol __ftol@8
MF2KGMG.obj : error LNK2001: unresolved external symbol __ftol2
SOLVERS.obj : error LNK2001: unresolved external symbol __ftol2

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #23 on: October 21, 2005, 12:33:20 pm »
...The problem continues... :
CCFD.obj : error LNK2001: unresolved external symbol __ftol@8
MF2KGMG.obj : error LNK2001: unresolved external symbol __ftol2
SOLVERS.obj : error LNK2001: unresolved external symbol __ftol2
try linking with
Code
msvcrt.lib
and be sure ,that you compile in "C" mode

or mind posting your complete project here,
because soothsaying is quite hard...

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #24 on: October 21, 2005, 12:35:44 pm »
Hello,

I am not sure how you try to put together .c, .h and .f files. Anyway, you can try to download (if not yet done) the Microsoft Platform SDK and to add to CB the corresponding include and lib directories.

May be you can also try to google your problem. Sometimes you get useful links or informations to what to do.

Best wishes,
Michael

alixia

  • Guest
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #25 on: October 21, 2005, 01:14:18 pm »
The libraries that I´ve included are:

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib msvcrt.lib libc.lib gmg1_2.lib

Already I´ve included msvcrt.lib like you can see.


Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #26 on: October 21, 2005, 01:34:06 pm »
Hello,

Then, as suggested by Tiwag, try to post your project. It would be easier to detect what it is wrong.

Best wishes,
Michael

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #27 on: October 21, 2005, 05:21:46 pm »
What i mean with converting to MSVC workspace, was that you should grab the Solution and convert it - i think there was a project converter tool, i don't remember exactly. But I recall from elsewhere in the forums that C::B has a problem with importing some MSVC solutions.

alixia

  • Guest
Re: Issues in importing a MS Visual C++ .NET 2003 solution
« Reply #28 on: October 22, 2005, 12:22:11 pm »
My problem was resolved!!!
In my settings I had the option "Not using MFC" and I changed this.