P Kumar
P Kumar

Reputation: 105

Porting from Visual Studio Application to Qt Application

I have one project whose .SLN file is there and we are able to run the project on Visual Studio 2008 and In which we have qt extension added that we are using In our project.

I have tried to create .pro and pri using following link: Converting .Sln Project to .pro Project

I have able see related lib and manage to add required file. But the Code is too specific to VS.

I am getting Issue Like :

1) Cannot Convert from TCHAR to Const Char*

2)cc1plus.exe: error: one or more PCH files were found, but they were invalid

3)cc1plus.exe: error: use -Winvalid-pch for more information

4)cc1plus.exe: fatal error: release\StdAfx.h: No such file or directory

5) error: conflicting declaration of C function 'int WinMain(HINSTANCE, HINSTANCE, LPTSTR, int)' int _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)

From these I came to conclusion that the code is more specific to Visual Studio.

I am using following tools pls correct me If I am not using correct version:

1)Qt Creator 3.6.1 Based on Qt 5.6.0 (MSVC 2013, 32 bit)

Is there any specific way to port code from VS2008 to Qt 5.6 or 5.7.

Upvotes: 0

Views: 1142

Answers (3)

CanardMoussant
CanardMoussant

Reputation: 923

What you already did - I guess - is to migrate the visual studio project file to a Qt one. However, if you want to fully migrate to Qt and write a cross-platform application, you should replace all MFC-specific code to Qt, which is very different. For instance WinMain is (as expected) specific to windows: you should have a simple main. In there, you would need to define a QApplication, and so on...

My advice would probably be to start with some small Qt samples before tackling a full-fledged migration. You can then come back with more specific questions to stackoverflow if you get stuck.

Upvotes: 1

Malcolm McLean
Malcolm McLean

Reputation: 6406

It's just trivia.

Microsoft tried to introduce international characters to Windows too early, before the Unicode consortium had done its work, and got everything in a twist. So the Windows functions can be passing string about as various things, plain ascii, w_chars, TCHARS and so on. You need to make everything consistent. Every Windows function that takes a string has two forms, A for ascii or W for wide. You need to make everything consistent and make sure the the functions are getting the right forms. Which might involve inserting a few glue functions to convert strings from wide to ascii and back.

There's nothing deeply wrong, but it is a bit of a job.

Upvotes: 0

P Kumar
P Kumar

Reputation: 105

Using MSVC compiler Could solved the Problem !!!!

Upvotes: 0

Related Questions