News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Issues in importing a MS Visual C++ .NET 2003 solution

Started by Michael, August 08, 2005, 12:24:54 PM

Previous topic - Next topic

Michael

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
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

alixia

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.

Urxae

Quote from: alixia 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.

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:

#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:


#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

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! :,(

rickg22

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

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?

rickg22

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

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

tiwag

Quote from: alixia on October 21, 2005, 12:04:55 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 msvcrt.lib and be sure ,that you compile in "C" mode

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

Michael

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
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

alixia

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.


Michael

Hello,

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

Best wishes,
Michael
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

rickg22

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

My problem was resolved!!!
In my settings I had the option "Not using MFC" and I changed this.