Jump to content

  • Log In with Google      Sign In   
  • Create Account


[VS 2010 C++] Strange behavior including boost


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
13 replies to this topic

#1 bombshell93   Members   -  Reputation: 198

Like
0Likes
Like

Posted 19 July 2011 - 12:50 AM

I'm pretty confused.
I tried including the boost thread library to get working with multi-threading within my DLL
but some off stuff happened.
I added the necessary directories into the project settings and put in
#include <boost\thread.hpp>
but it told me the file didn't exist. (which it did)
I did some poking around and realized the problem, the directories needed for the header file were needed in the executable settings too.

Now the confusing part. After adding the directories to the project settings I started getting errors saying how Windows.h suddenly stopped existing!!
I "fixxed" this by having the settings inherit from default.
I put that in quotes because now I have a really odd problem, everything builds okay in debug (or so it seams) but when the program runs it doesn't even open a window. it does nothing at all.
just out of curiosity I decided to build in release. Which keeps giving me
1>------ Build started: Project: IndigoFramework, Configuration: Release Win32 ------
1>  Indigo.cpp
1>c:\users\bombshell\documents\visual studio 2010\projects\indigoengine\indigoengine\Indigo.h(8): fatal error C1083: Cannot open include file: 'd3dx11.h': No such file or directory
2>------ Build started: Project: IndigoEngine, Configuration: Release Win32 ------
2>  MProg.cpp
2>c:\users\bombshell\documents\visual studio 2010\projects\indigoengine\indigoengine\Indigo.h(8): fatal error C1083: Cannot open include file: 'd3dx11.h': No such file or directory========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========

but on further investigation, though I don't know why building release gives me those errors
removing the
#include <boost\thread.hpp>
from the DLL header file everything goes back to normal... (though building in release still gives the above error)

I'm just completely confused as to what is going on.
Any help is appreciated,
Thanks in advanced,
Bombshell

Sponsor:

#2 ApochPiQ   Moderators   -  Reputation: 14260

Like
0Likes
Like

Posted 19 July 2011 - 01:01 AM

The correct syntax for #include is #include <path/to/file.h> not <path\to\file.h>. The latter actually generates escape sequences which means you're not getting "path\to\file" you're getting, well, what's likely gibberish :-)

#3 Nanoha   Members   -  Reputation: 296

Like
0Likes
Like

Posted 19 July 2011 - 01:28 AM

The correct syntax for #include is #include <path/to/file.h> not <path\to\file.h>. The latter actually generates escape sequences which means you're not getting "path\to\file" you're getting, well, what's likely gibberish :-)


I'm not sure if thats the problem as VS is quite happy to accept either \ or / without generatign escape sequences. ..\ works as intended. I am curious as the right direction (\ or /) as I've never really been sure. I'm currently using \ with no problems - though whether that is the right thing to do or not I've no idea.

Bombshell, I would recheck the includes, remove them and try it again. I'm sure you've tried that a few times but thats the most likely problem. Don't add them as project includes, add them to VS itself Tools->Options->Projects and Solutions->VC++ Directories.

#4 rip-off   Moderators   -  Reputation: 7642

Like
0Likes
Like

Posted 19 July 2011 - 02:01 AM

#include directives are not string literals, escape sequences are not necessarily valid there. I believe they are actually implementation defined, apart from the standard headers of course.

#5 wqking   Members   -  Reputation: 756

Like
0Likes
Like

Posted 19 July 2011 - 02:14 AM

You need to set proper include paths in both debug and release mode.
Fire up your project setting dialog, then choose "release" target, check the include path.

BTW, you can use "boost\thread.hpp", but I think it's better to use '/' instead of '\' so it can be compiled anywhere (on Mac, Linux, etc). Though I'm not sure if '\' can compile on Linux.

http://www.cpgf.org/
cpgf library -- free C++ open source library for reflection, serialization, script binding, callbacks, and meta data for OpenGL Box2D, SFML and Irrlicht.
v1.5.5 was released. Now supports tween and timeline for ease animation.


#6 bombshell93   Members   -  Reputation: 198

Like
0Likes
Like

Posted 19 July 2011 - 06:16 AM

thanks for the clarification on the release problem.

as for debug when including boost
all the necessary directories are in VC++ Directories project settings.
But the program still does nothing after running.

I still find the strangest thing to be the fact that removing the boost include stops the problem.
I didn't think a single header file could have so much of a difference in getting the program to run.
To build sure, with linking problems or something, but the fact its building but not running has me most confused.

Here is what I get on build, seems relatively harmless
1>------ Build started: Project: IndigoFramework, Configuration: Debug Win32 ------
1>  Indigo.cpp
1>..\IndigoEngine\Indigo.cpp(10): warning C4244: '=' : conversion from 'float' to 'UINT', possible loss of data
1>..\IndigoEngine\Indigo.cpp(11): warning C4244: '=' : conversion from 'float' to 'UINT', possible loss of data
1>c:\program files (x86)\boost\boost_1_47\boost\thread\win32\basic_timed_mutex.hpp(160): warning C4793: 'boost::detail::basic_timed_mutex::unlock' : function compiled as native :
1>  	Found an intrinsic not supported in managed code
1>c:\program files (x86)\boost\boost_1_47\boost\thread\win32\thread_primitives.hpp(314): warning C4793: 'boost::detail::win32::interlocked_bit_test_and_set' : function compiled as native :
1>  	Found an intrinsic not supported in managed code
1>     Creating library C:\Users\Bombshell\documents\visual studio 2010\Projects\IndigoEngine\Debug\IndigoFramework.lib and object C:\Users\Bombshell\documents\visual studio 2010\Projects\IndigoEngine\Debug\IndigoFramework.exp
1>Indigo.obj : warning LNK4248: unresolved typeref token (01000023) for 'boost.detail.win32._SECURITY_ATTRIBUTES'; image may not run
1>  IndigoFramework.vcxproj -> C:\Users\Bombshell\documents\visual studio 2010\Projects\IndigoEngine\Debug\IndigoFramework.dll
2>------ Build started: Project: IndigoEngine, Configuration: Debug Win32 ------
2>  MProg.cpp
2>  LINK : C:\Users\Bombshell\documents\visual studio 2010\Projects\IndigoEngine\Debug\IndigoEngine.exe not found or not built by the last incremental link; performing full link
2>  IndigoEngine.vcxproj -> C:\Users\Bombshell\documents\visual studio 2010\Projects\IndigoEngine\Debug\IndigoEngine.exe========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

And heres what I get on Debug
'IndigoEngine.exe': Loaded 'C:\Users\Bombshell\Documents\Visual Studio 2010\Projects\IndigoEngine\Debug\IndigoEngine.exe', Symbols loaded.
'IndigoEngine.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'IndigoEngine.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'IndigoEngine.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'IndigoEngine.exe': Loaded 'C:\Users\Bombshell\Documents\Visual Studio 2010\Projects\IndigoEngine\Debug\IndigoFramework.dll', Symbols loaded.
'IndigoEngine.exe': Loaded 'C:\Windows\SysWOW64\mscoree.dll', Cannot find or open the PDB file
'IndigoEngine.exe': Unloaded 'C:\Windows\SysWOW64\mscoree.dll'
'IndigoEngine.exe': Unloaded 'C:\Users\Bombshell\Documents\Visual Studio 2010\Projects\IndigoEngine\Debug\IndigoFramework.dll'
The program '[4528] IndigoEngine.exe: Native' has exited with code -1073741701 (0xc000007b).


#7 Rattrap   Members   -  Reputation: 1495

Like
0Likes
Like

Posted 19 July 2011 - 06:34 AM

1>c:\program files (x86)\boost\boost_1_47\boost\thread\win32\basic_timed_mutex.hpp(160): warning C4793: 'boost::detail::basic_timed_mutex::unlock' : function compiled as native :
1> Found an intrinsic not supported in managed code
1>c:\program files (x86)\boost\boost_1_47\boost\thread\win32\thread_primitives.hpp(314): warning C4793: 'boost::detail::win32::interlocked_bit_test_and_set' : function compiled as native :
1> Found an intrinsic not supported in managed code


Are you using C++/CLI? It looks like it is complaining about boost's use of non-managed code along with managed code.

#8 bombshell93   Members   -  Reputation: 198

Like
0Likes
Like

Posted 19 July 2011 - 06:47 AM

I'm not using C++/CLI... at least not to my knowledge
Intellisence still works and it was to my understanding it didn't work with projects that included / used C++/CLI (I've come across VS 2010 commenting on it in the bottom right corner when looking at certain code examples)

#9 Rattrap   Members   -  Reputation: 1495

Like
1Likes
Like

Posted 19 July 2011 - 06:55 AM

I'm not using C++/CLI... at least not to my knowledge
Intellisence still works and it was to my understanding it didn't work with projects that included / used C++/CLI (I've come across VS 2010 commenting on it in the bottom right corner when looking at certain code examples)


I just tried creating a test C++/CLI project in VC2010 and included <boost/thread.hpp> and got the exact same error you did.

1>------ Build started: Project: CLRTest, Configuration: Debug Win32 ------
1>Build started 7/19/2011 8:51:27 AM.
1>InitializeBuildStatus:
1> Creating "E:\Programming\CLRTest\_Obj\Win32\Debug\CLRTest\CLRTest.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> stdafx.cpp
1> AssemblyInfo.cpp
1> CLRTest.cpp
1> Generating Code...
1>e:\programming\boost\boost\thread\win32\basic_timed_mutex.hpp(160): warning C4793: 'boost::detail::basic_timed_mutex::unlock' : function compiled as native :
1> Found an intrinsic not supported in managed code
1>e:\programming\boost\boost\thread\win32\thread_primitives.hpp(314): warning C4793: 'boost::detail::win32::interlocked_bit_test_and_set' : function compiled as native :
1> Found an intrinsic not supported in managed code

1> .NETFramework,Version=v4.0.AssemblyAttributes.cpp
1>C:\Users\Rob Yull\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.cpp : fatal error C1083: Cannot open compiler generated file: 'E:\Programming\CLRTest\_Obj\Win32\Debug\CLRTest\C:\Users\Rob Yull\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.obj': Invalid argument
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:04.30
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


It looks like your IndigoFramework project is C++/CLI.

You are correct about Intellisense and C++/CLI, but I'm guessing only one of the projects may be incorrectly setup this way.

#10 Rattrap   Members   -  Reputation: 1495

Like
1Likes
Like

Posted 19 July 2011 - 07:42 AM

The correct syntax for #include is #include <path/to/file.h> not <path\to\file.h>.


VC 2010 Pro (not sure about express) actually has the option to auto-complete includes either with either slash (defaults to \ )

VS2010Slash.png




#11 bombshell93   Members   -  Reputation: 198

Like
0Likes
Like

Posted 19 July 2011 - 07:53 AM

do you think they could be causing the problem of the program doing nothing?
if so what would I be looking for that indicates CLI?
I'm unfamiliar with the language, but taking a quick google it seems similar to C# (with that being the coding language I'm most familiar with its plausible I used similar code in C++ by mistake)

#12 Rattrap   Members   -  Reputation: 1495

Like
2Likes
Like

Posted 19 July 2011 - 08:05 AM

do you think they could be causing the problem of the program doing nothing?
if so what would I be looking for that indicates CLI?
I'm unfamiliar with the language, but taking a quick google it seems similar to C# (with that being the coding language I'm most familiar with its plausible I used similar code in C++ by mistake)


It's basically a modified version of C++ that uses the .Net Common Language Runtime. Check your project files (Right click on the Project and choose Properties). Check under General -> Common Language Runtime Support and see if it says Common Language Runtime Support /clr (see picture below)

VS2010CLR.png


If it is there, try changing it to No Common Language Runtime Support.

#13 bombshell93   Members   -  Reputation: 198

Like
0Likes
Like

Posted 19 July 2011 - 08:11 AM

thanks loads!
Everything builds and runs fine now :D

#14 Rattrap   Members   -  Reputation: 1495

Like
0Likes
Like

Posted 19 July 2011 - 08:15 AM

Good to hear.

Be sure to check this under the Release settings too, as Release may still be set to CLR enabled.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS