Author Topic: Transfering project from VS to CodeBlocks  (Read 24881 times)

Offline user321

  • Single posting newcomer
  • *
  • Posts: 9
Re: Transfering project from VS to CodeBlocks
« Reply #15 on: June 04, 2013, 12:04:11 am »
If you succeded to build it, could you please upload zip of your project? also which compiler are you using?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Transfering project from VS to CodeBlocks
« Reply #16 on: June 04, 2013, 12:56:33 am »
If you succeded to build it, could you please upload zip of your project? also which compiler are you using?
This was a general help, not specific to your problem...
I don't know what you are trying to build. (And i don't have the time to make it for you, this is a good exercise to learn how compiler, linker and IDE work together)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Transfering project from VS to CodeBlocks
« Reply #17 on: June 04, 2013, 03:39:28 am »
FYI:

To convert a project from Compiler A to Compiler B.

You must know Compiler B very well. And, you should know a little about Compiler A.

Next, you need to know the basics of Compilers in General.

And, this project was written to only use C++ Visual Studio for Newbies.

I got it to link by doing three additional things past the Usual.

Note: I have no idea if it will Run or is Safe to run.

1. I defined "VJOY_EXPORTS"

2. I linked directly to the VJoy.dll using absolute path.
This is NOT a good thing to do; but, when you link to a Library you do NOT have the source code for you sometimes need to do it.

If the DLL has C linkage it should be safe.
No Idea what Linkage the DLL has it could be C++.

The third item is NOT one I would expect a Newbie to figure out. I modified the code.
The example should have been written in C if the DLL is really a C DLL; but, it is written in C++.
Either the person writing the sample code did NOT know very much or it is a C++ DLL.
Edit: Saving/Renaming the cpp file as a c files fixes the third problem without needing to edit the file.
Edit4: I am guessing the person who wrote the C++ file did not know very much about C++/C portability.

Original Code
Code
#include "VJoy.h"

Modified Code
Code
extern "C" {
#include "VJoy.h"
}

Note: None of my Answers are for questions allowed on this site; this thread is likely to be deleted or locked.

Edit2: These are answers appropriate to be asked and answered on a programming site like here http://cboard.cprogramming.com/forum.php

Edit2b: But, if you need help doing the three things I did to get the project to compile and link it would be OK to ask how to do it.
Edit3: But, please read the FAQ and the User Manual for items 1; I do NOT know of any FAQ to help with Items 2 and 3.


Tim S.
« Last Edit: June 04, 2013, 03:58:48 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org