News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Transfering project from VS to CodeBlocks

Started by user321, June 02, 2013, 10:35:15 PM

Previous topic - Next topic

user321

I'm trying to compile some code from this website http://headsoft.com.au/index.php?category=vjoy  (SDK C++) in CodeBlocks.

Its working in VS (there is .dsp file), but I don't really like it. So I created new project in CodeBlocks included all files, linked library (I think I dd it good), but I just can't get it to compile :S

If I press "Keep this relative path"> Yes while adding library, then I get error ld.exe||cannot find -lVJoy.lib

If I press "Keep this relative path"> No while adding library, then I get following error :

obj\Debug\x\main.o||In function `main':|
\main.cpp|12|undefined reference to `_imp___Z15VJoy_InitializePcS_@8'|
\main.cpp|20|undefined reference to `_imp___Z19VJoy_UpdateJoyStateiP15_JOYSTICK_STATE@8'|
\main.cpp|22|undefined reference to `_imp___Z13VJoy_Shutdownv@0'|
||=== Build finished: 3 errors, 0 warnings (0 minutes, 0 seconds) ===|


stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

user321

Thanks for the link, I didn't know its possible to import VC++ project, but even when I import this project which is working flawlessly on VC, its getting me same errors as before. I know that errors are about linking library, but why are they happening :S

BTW
I encountered CodeBlocks crash.
First I clicked on import Visual C++, then import Visual Studio project while project was opened, select compiler... and crash each time. would be nice to fix this.

oBFusCATed

about the crash: Start with your OS/C::B/compiler versions. Guessing them would be impossible, because my magic ball is out of mana!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

user321

oh sorry, I forgot to mention  ???

I am using Windows 7 x64
Codeblocks 12.11
and compiler is the standard one which comes with 12.11 (GNU)

Maybe someone else could also try to import that project and maybe confirm crash?
once I import .dsp file, guess it somehow locks .vcproj (overwrites?) , and when it tries to open it ... crashes?

stahta01

FYI: Code::Blocks is a C++ IDE!!
It is NOT a VB or C# IDE.

Importing VB or C# projects was never supported!!

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

user321

Quote from: stahta01 on June 03, 2013, 06:12:58 PM
FYI: Code::Blocks is a C++ IDE!!
It is NOT a VB or C# IDE.

Importing VB or C# projects was never supported!!

Tim S.
where did I mention C# or basic?  ???
I know its C++ IDE, and I'm trying to import C++ project ...

stahta01

Apologies,  I thought dsp was in C# or VB folder.

I imported the dsp project and it gave errors/warning during importing; but, I saw no crash of CB.

I used Windows 7 32 bit and Code::Blocks 12.11

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

user321

Quote from: stahta01 on June 03, 2013, 08:16:33 PM
Apologies,  I thought dsp was in C# or VB folder.

I imported the dsp project and it gave errors/warning during importing; but, I saw no crash of CB.

I used Windows 7 32 bit and Code::Blocks 12.11

Tim S.
Did you tried to import MS Visual Studio Project after you already imported and have opened Visual C++ project (.dsp).

For me crash happens like that.

Anyway, did you successed to build it ?

MortenMacFly

Quote from: user321 on June 03, 2013, 08:39:03 PM
For me crash happens like that.
Samples and steps to reproduce please, otherwise you producing forum noise and we cant help.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

BlueHazzard

Quote from: user321 on June 02, 2013, 10:35:15 PM
If I press "Keep this relative path"> Yes while adding library, then I get error ld.exe||cannot find -lVJoy.lib

If I press "Keep this relative path"> No while adding library, then I get following error :

obj\Debug\x\main.o||In function `main':|
\main.cpp|12|undefined reference to `_imp___Z15VJoy_InitializePcS_@8'|
\main.cpp|20|undefined reference to `_imp___Z19VJoy_UpdateJoyStateiP15_JOYSTICK_STATE@8'|
\main.cpp|22|undefined reference to `_imp___Z13VJoy_Shutdownv@0'|
||=== Build finished: 3 errors, 0 warnings (0 minutes, 0 seconds) ===|

Can you post the build log? Not the build Messages but the build log!

user321

Quote from: MortenMacFly on June 03, 2013, 10:32:32 PM
Quote from: user321 on June 03, 2013, 08:39:03 PM
For me crash happens like that.
Samples and steps to reproduce please, otherwise you producing forum noise and we cant help.
Here is short video of how it happens : http://www.mediafire.com/download/q9ku3l755ynlwu5/crash2.7z


Quote from: BlueHazzard on June 03, 2013, 11:08:44 PM
Quote from: user321 on June 02, 2013, 10:35:15 PM
If I press "Keep this relative path"> Yes while adding library, then I get error ld.exe||cannot find -lVJoy.lib

If I press "Keep this relative path"> No while adding library, then I get following error :

obj\Debug\x\main.o||In function `main':|
\main.cpp|12|undefined reference to `_imp___Z15VJoy_InitializePcS_@8'|
\main.cpp|20|undefined reference to `_imp___Z19VJoy_UpdateJoyStateiP15_JOYSTICK_STATE@8'|
\main.cpp|22|undefined reference to `_imp___Z13VJoy_Shutdownv@0'|
||=== Build finished: 3 errors, 0 warnings (0 minutes, 0 seconds) ===|

Can you post the build log? Not the build Messages but the build log!


-------------- Build: Win32 Release in VJoy (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe  -o "...\VJoySDK\VJoy SDK\C++\Release\VJoy.exe" Release\StdAfx.o Release\VJoy.o    -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lcomctl32
Release\VJoy.o:VJoy.cpp:(.text.startup+0x1d): undefined reference to `_imp___Z15VJoy_InitializePcS_@8'
Release\VJoy.o:VJoy.cpp:(.text.startup+0x23): undefined reference to `_imp___Z13VJoy_Shutdownv@0'
Release\VJoy.o:VJoy.cpp:(.text.startup+0x79): undefined reference to `_imp___Z19VJoy_UpdateJoyStateiP15_JOYSTICK_STATE@8'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
3 errors, 0 warnings (0 minutes, 0 seconds)


BlueHazzard

Quote from: user321 on June 03, 2013, 11:25:29 PM
-------------- Build: Win32 Release in VJoy (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe  -o "...\VJoySDK\VJoy SDK\C++\Release\VJoy.exe" Release\StdAfx.o Release\VJoy.o    -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lcomctl32
Release\VJoy.o:VJoy.cpp:(.text.startup+0x1d): undefined reference to `_imp___Z15VJoy_InitializePcS_@8'
Release\VJoy.o:VJoy.cpp:(.text.startup+0x23): undefined reference to `_imp___Z13VJoy_Shutdownv@0'
Release\VJoy.o:VJoy.cpp:(.text.startup+0x79): undefined reference to `_imp___Z19VJoy_UpdateJoyStateiP15_JOYSTICK_STATE@8'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
3 errors, 0 warnings (0 minutes, 0 seconds)


i think you miss VJoy.lib so, add it under Project->Build Options->Linker Settings
Add in Project->Build Options->Search Directories->Linker the path to  the lib, and if it fails again post again the build log
thx

user321

Quote from: BlueHazzard on June 03, 2013, 11:39:05 PM


i think you miss VJoy.lib so, add it under Project->Build Options->Linker Settings
Add in Project->Build Options->Search Directories->Linker the path to  the lib, and if it fails again post again the build log
thx
check first post:
Quote from: user321 on June 02, 2013, 10:35:15 PM
If I press "Keep this relative path"> Yes while adding library, then I get error ld.exe||cannot find -lVJoy.lib

If I press "Keep this relative path"> No while adding library, then I get following error :

obj\Debug\x\main.o||In function `main':|
\main.cpp|12|undefined reference to `_imp___Z15VJoy_InitializePcS_@8'|
\main.cpp|20|undefined reference to `_imp___Z19VJoy_UpdateJoyStateiP15_JOYSTICK_STATE@8'|
\main.cpp|22|undefined reference to `_imp___Z13VJoy_Shutdownv@0'|
||=== Build finished: 3 errors, 0 warnings (0 minutes, 0 seconds) ===|

I already linked it, but for some reason it asks me do I want to keep this relative path to linker... dunno what that means :S I tried both options, but noone of them work ???

BlueHazzard


Keep this relative path> No

Keep relative path means, it saves the path relative to your project folder
No means it uses an absolute path.
For me adding only the library without path, and then adding the path in the Search path from the linker worked always.

Quote from: BlueHazzard on June 03, 2013, 11:08:44 PM
Add in Project->Build Options->Search Directories->Linker the path
Can you post the build log? Not the build Messages but the build log!

Don't forget FULL BUILD LOG FROM BUILD MESSAGES