User forums > Using Code::Blocks

Transfering project from VS to CodeBlocks

<< < (4/4)

user321:
If you succeded to build it, could you please upload zip of your project? also which compiler are you using?

BlueHazzard:

--- Quote from: user321 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?

--- End quote ---
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)

stahta01:
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"

--- End code ---

Modified Code

--- Code: ---extern "C" {
#include "VJoy.h"
}

--- End code ---

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.

Navigation

[0] Message Index

[*] Previous page

Go to full version